calc.c revision 1.1.1.3 1 1.1.1.2 mrg /* A Bison parser, made by GNU Bison 2.7.12-4996. */
2 1.1 mrg
3 1.1.1.2 mrg /* Bison implementation for Yacc-like parsers in C
4 1.1 mrg
5 1.1.1.2 mrg Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
6 1.1 mrg
7 1.1 mrg This program is free software: you can redistribute it and/or modify
8 1.1 mrg it under the terms of the GNU General Public License as published by
9 1.1 mrg the Free Software Foundation, either version 3 of the License, or
10 1.1 mrg (at your option) any later version.
11 1.1 mrg
12 1.1 mrg This program is distributed in the hope that it will be useful,
13 1.1 mrg but WITHOUT ANY WARRANTY; without even the implied warranty of
14 1.1 mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 1.1 mrg GNU General Public License for more details.
16 1.1 mrg
17 1.1 mrg You should have received a copy of the GNU General Public License
18 1.1 mrg along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 1.1 mrg
20 1.1 mrg /* As a special exception, you may create a larger work that contains
21 1.1 mrg part or all of the Bison parser skeleton and distribute that work
22 1.1 mrg under terms of your choice, so long as that work isn't itself a
23 1.1 mrg parser generator using the skeleton or a modified version thereof
24 1.1 mrg as a parser skeleton. Alternatively, if you modify or redistribute
25 1.1 mrg the parser skeleton itself, you may (at your option) remove this
26 1.1 mrg special exception, which will cause the skeleton and the resulting
27 1.1 mrg Bison output files to be licensed under the GNU General Public
28 1.1 mrg License without this special exception.
29 1.1 mrg
30 1.1 mrg This special exception was added by the Free Software Foundation in
31 1.1 mrg version 2.2 of Bison. */
32 1.1 mrg
33 1.1 mrg /* C LALR(1) parser skeleton written by Richard Stallman, by
34 1.1 mrg simplifying the original so-called "semantic" parser. */
35 1.1 mrg
36 1.1 mrg /* All symbols defined below should begin with yy or YY, to avoid
37 1.1 mrg infringing on user name space. This should be done even for local
38 1.1 mrg variables, as they might otherwise be expanded by user macros.
39 1.1 mrg There are some unavoidable exceptions within include files to
40 1.1 mrg define necessary library symbols; they are noted "INFRINGES ON
41 1.1 mrg USER NAME SPACE" below. */
42 1.1 mrg
43 1.1 mrg /* Identify Bison output. */
44 1.1 mrg #define YYBISON 1
45 1.1 mrg
46 1.1 mrg /* Bison version. */
47 1.1.1.2 mrg #define YYBISON_VERSION "2.7.12-4996"
48 1.1 mrg
49 1.1 mrg /* Skeleton name. */
50 1.1 mrg #define YYSKELETON_NAME "yacc.c"
51 1.1 mrg
52 1.1 mrg /* Pure parsers. */
53 1.1 mrg #define YYPURE 0
54 1.1 mrg
55 1.1 mrg /* Push parsers. */
56 1.1 mrg #define YYPUSH 0
57 1.1 mrg
58 1.1 mrg /* Pull parsers. */
59 1.1 mrg #define YYPULL 1
60 1.1 mrg
61 1.1 mrg
62 1.1 mrg
63 1.1 mrg
64 1.1 mrg /* Copy the first part of user declarations. */
65 1.1.1.2 mrg /* Line 371 of yacc.c */
66 1.1.1.3 mrg #line 1 "../../../gmp/demos/calc/calc.y"
67 1.1 mrg
68 1.1 mrg /* A simple integer desk calculator using yacc and gmp.
69 1.1 mrg
70 1.1.1.3 mrg Copyright 2000-2002 Free Software Foundation, Inc.
71 1.1 mrg
72 1.1 mrg This file is part of the GNU MP Library.
73 1.1 mrg
74 1.1 mrg This program is free software; you can redistribute it and/or modify it under
75 1.1 mrg the terms of the GNU General Public License as published by the Free Software
76 1.1 mrg Foundation; either version 3 of the License, or (at your option) any later
77 1.1 mrg version.
78 1.1 mrg
79 1.1 mrg This program is distributed in the hope that it will be useful, but WITHOUT ANY
80 1.1 mrg WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
81 1.1 mrg PARTICULAR PURPOSE. See the GNU General Public License for more details.
82 1.1 mrg
83 1.1 mrg You should have received a copy of the GNU General Public License along with
84 1.1.1.3 mrg this program. If not, see https://www.gnu.org/licenses/. */
85 1.1 mrg
86 1.1 mrg
87 1.1 mrg /* This is a simple program, meant only to show one way to use GMP for this
88 1.1 mrg sort of thing. There's few features, and error checking is minimal.
89 1.1 mrg Standard input is read, calc_help() below shows the inputs accepted.
90 1.1 mrg
91 1.1 mrg Expressions are evaluated as they're read. If user defined functions
92 1.1 mrg were wanted it'd be necessary to build a parse tree like pexpr.c does, or
93 1.1 mrg a list of operations for a stack based evaluator. That would also make
94 1.1 mrg it possible to detect and optimize evaluations "mod m" like pexpr.c does.
95 1.1 mrg
96 1.1 mrg A stack is used for intermediate values in the expression evaluation,
97 1.1 mrg separate from the yacc parser stack. This is simple, makes error
98 1.1 mrg recovery easy, minimizes the junk around mpz calls in the rules, and
99 1.1 mrg saves initializing or clearing "mpz_t"s during a calculation. A
100 1.1 mrg disadvantage though is that variables must be copied to the stack to be
101 1.1 mrg worked on. A more sophisticated calculator or language system might be
102 1.1 mrg able to avoid that when executing a compiled or semi-compiled form.
103 1.1 mrg
104 1.1 mrg Avoiding repeated initializing and clearing of "mpz_t"s is important. In
105 1.1 mrg this program the time spent parsing is obviously much greater than any
106 1.1 mrg possible saving from this, but a proper calculator or language should
107 1.1 mrg take some trouble over it. Don't be surprised if an init/clear takes 3
108 1.1 mrg or more times as long as a 10 limb addition, depending on the system (see
109 1.1 mrg the mpz_init_realloc_clear example in tune/README). */
110 1.1 mrg
111 1.1 mrg
112 1.1 mrg #include <stdio.h>
113 1.1 mrg #include <stdlib.h>
114 1.1 mrg #include <string.h>
115 1.1 mrg #include "gmp.h"
116 1.1 mrg #define NO_CALC_H /* because it conflicts with normal calc.c stuff */
117 1.1 mrg #include "calc-common.h"
118 1.1 mrg
119 1.1 mrg
120 1.1 mrg #define numberof(x) (sizeof (x) / sizeof ((x)[0]))
121 1.1 mrg
122 1.1 mrg
123 1.1 mrg void
124 1.1 mrg calc_help (void)
125 1.1 mrg {
126 1.1 mrg printf ("Examples:\n");
127 1.1 mrg printf (" 2+3*4 expressions are evaluated\n");
128 1.1 mrg printf (" x=5^6 variables a to z can be set and used\n");
129 1.1 mrg printf ("Operators:\n");
130 1.1 mrg printf (" + - * arithmetic\n");
131 1.1 mrg printf (" / %% division and remainder (rounding towards negative infinity)\n");
132 1.1 mrg printf (" ^ exponentiation\n");
133 1.1 mrg printf (" ! factorial\n");
134 1.1 mrg printf (" << >> left and right shifts\n");
135 1.1 mrg printf (" <= >= > \\ comparisons, giving 1 if true, 0 if false\n");
136 1.1 mrg printf (" == != < /\n");
137 1.1 mrg printf (" && || logical and/or, giving 1 if true, 0 if false\n");
138 1.1 mrg printf ("Functions:\n");
139 1.1 mrg printf (" abs(n) absolute value\n");
140 1.1 mrg printf (" bin(n,m) binomial coefficient\n");
141 1.1 mrg printf (" fib(n) fibonacci number\n");
142 1.1 mrg printf (" gcd(a,b,..) greatest common divisor\n");
143 1.1 mrg printf (" kron(a,b) kronecker symbol\n");
144 1.1 mrg printf (" lcm(a,b,..) least common multiple\n");
145 1.1 mrg printf (" lucnum(n) lucas number\n");
146 1.1 mrg printf (" nextprime(n) next prime after n\n");
147 1.1 mrg printf (" powm(b,e,m) modulo powering, b^e%%m\n");
148 1.1 mrg printf (" root(n,r) r-th root\n");
149 1.1 mrg printf (" sqrt(n) square root\n");
150 1.1 mrg printf ("Other:\n");
151 1.1 mrg printf (" hex \\ set hex or decimal for input and output\n");
152 1.1 mrg printf (" decimal / (\"0x\" can be used for hex too)\n");
153 1.1 mrg printf (" quit exit program (EOF works too)\n");
154 1.1 mrg printf (" ; statements are separated with a ; or newline\n");
155 1.1 mrg printf (" \\ continue expressions with \\ before newline\n");
156 1.1 mrg printf (" # xxx comments are # though to newline\n");
157 1.1 mrg printf ("Hex numbers must be entered in upper case, to distinguish them from the\n");
158 1.1 mrg printf ("variables a to f (like in bc).\n");
159 1.1 mrg }
160 1.1 mrg
161 1.1 mrg
162 1.1 mrg int ibase = 0;
163 1.1 mrg int obase = 10;
164 1.1 mrg
165 1.1 mrg
166 1.1 mrg /* The stack is a fixed size, which means there's a limit on the nesting
167 1.1 mrg allowed in expressions. A more sophisticated program could let it grow
168 1.1 mrg dynamically. */
169 1.1 mrg
170 1.1 mrg mpz_t stack[100];
171 1.1 mrg mpz_ptr sp = stack[0];
172 1.1 mrg
173 1.1 mrg #define CHECK_OVERFLOW() \
174 1.1 mrg if (sp >= stack[numberof(stack)]) /* FIXME */ \
175 1.1 mrg { \
176 1.1 mrg fprintf (stderr, \
177 1.1 mrg "Value stack overflow, too much nesting in expression\n"); \
178 1.1 mrg YYERROR; \
179 1.1 mrg }
180 1.1 mrg
181 1.1 mrg #define CHECK_EMPTY() \
182 1.1 mrg if (sp != stack[0]) \
183 1.1 mrg { \
184 1.1 mrg fprintf (stderr, "Oops, expected the value stack to be empty\n"); \
185 1.1 mrg sp = stack[0]; \
186 1.1 mrg }
187 1.1 mrg
188 1.1 mrg
189 1.1 mrg mpz_t variable[26];
190 1.1 mrg
191 1.1 mrg #define CHECK_VARIABLE(var) \
192 1.1 mrg if ((var) < 0 || (var) >= numberof (variable)) \
193 1.1 mrg { \
194 1.1 mrg fprintf (stderr, "Oops, bad variable somehow: %d\n", var); \
195 1.1 mrg YYERROR; \
196 1.1 mrg }
197 1.1 mrg
198 1.1 mrg
199 1.1 mrg #define CHECK_UI(name,z) \
200 1.1 mrg if (! mpz_fits_ulong_p (z)) \
201 1.1 mrg { \
202 1.1 mrg fprintf (stderr, "%s too big\n", name); \
203 1.1 mrg YYERROR; \
204 1.1 mrg }
205 1.1 mrg
206 1.1 mrg
207 1.1.1.2 mrg /* Line 371 of yacc.c */
208 1.1.1.2 mrg #line 209 "calc.c"
209 1.1 mrg
210 1.1.1.2 mrg # ifndef YY_NULL
211 1.1.1.2 mrg # if defined __cplusplus && 201103L <= __cplusplus
212 1.1.1.2 mrg # define YY_NULL nullptr
213 1.1.1.2 mrg # else
214 1.1.1.2 mrg # define YY_NULL 0
215 1.1.1.2 mrg # endif
216 1.1.1.2 mrg # endif
217 1.1 mrg
218 1.1 mrg /* Enabling verbose error messages. */
219 1.1 mrg #ifdef YYERROR_VERBOSE
220 1.1 mrg # undef YYERROR_VERBOSE
221 1.1 mrg # define YYERROR_VERBOSE 1
222 1.1 mrg #else
223 1.1 mrg # define YYERROR_VERBOSE 0
224 1.1 mrg #endif
225 1.1 mrg
226 1.1.1.2 mrg /* In a future release of Bison, this section will be replaced
227 1.1.1.2 mrg by #include "y.tab.h". */
228 1.1.1.3 mrg #ifndef YY_YY_CALC_H_INCLUDED
229 1.1.1.3 mrg # define YY_YY_CALC_H_INCLUDED
230 1.1.1.2 mrg /* Enabling traces. */
231 1.1.1.2 mrg #ifndef YYDEBUG
232 1.1.1.2 mrg # define YYDEBUG 0
233 1.1.1.2 mrg #endif
234 1.1.1.2 mrg #if YYDEBUG
235 1.1.1.2 mrg extern int yydebug;
236 1.1 mrg #endif
237 1.1 mrg
238 1.1 mrg /* Tokens. */
239 1.1 mrg #ifndef YYTOKENTYPE
240 1.1 mrg # define YYTOKENTYPE
241 1.1 mrg /* Put the tokens into the symbol table, so that GDB and other debuggers
242 1.1 mrg know about them. */
243 1.1 mrg enum yytokentype {
244 1.1 mrg EOS = 258,
245 1.1 mrg BAD = 259,
246 1.1 mrg HELP = 260,
247 1.1 mrg HEX = 261,
248 1.1 mrg DECIMAL = 262,
249 1.1 mrg QUIT = 263,
250 1.1 mrg ABS = 264,
251 1.1 mrg BIN = 265,
252 1.1 mrg FIB = 266,
253 1.1 mrg GCD = 267,
254 1.1 mrg KRON = 268,
255 1.1 mrg LCM = 269,
256 1.1 mrg LUCNUM = 270,
257 1.1 mrg NEXTPRIME = 271,
258 1.1 mrg POWM = 272,
259 1.1 mrg ROOT = 273,
260 1.1 mrg SQRT = 274,
261 1.1 mrg NUMBER = 275,
262 1.1 mrg VARIABLE = 276,
263 1.1 mrg LOR = 277,
264 1.1 mrg LAND = 278,
265 1.1 mrg GE = 279,
266 1.1 mrg LE = 280,
267 1.1 mrg NE = 281,
268 1.1 mrg EQ = 282,
269 1.1 mrg RSHIFT = 283,
270 1.1 mrg LSHIFT = 284,
271 1.1 mrg UMINUS = 285
272 1.1 mrg };
273 1.1 mrg #endif
274 1.1 mrg /* Tokens. */
275 1.1 mrg #define EOS 258
276 1.1 mrg #define BAD 259
277 1.1 mrg #define HELP 260
278 1.1 mrg #define HEX 261
279 1.1 mrg #define DECIMAL 262
280 1.1 mrg #define QUIT 263
281 1.1 mrg #define ABS 264
282 1.1 mrg #define BIN 265
283 1.1 mrg #define FIB 266
284 1.1 mrg #define GCD 267
285 1.1 mrg #define KRON 268
286 1.1 mrg #define LCM 269
287 1.1 mrg #define LUCNUM 270
288 1.1 mrg #define NEXTPRIME 271
289 1.1 mrg #define POWM 272
290 1.1 mrg #define ROOT 273
291 1.1 mrg #define SQRT 274
292 1.1 mrg #define NUMBER 275
293 1.1 mrg #define VARIABLE 276
294 1.1 mrg #define LOR 277
295 1.1 mrg #define LAND 278
296 1.1 mrg #define GE 279
297 1.1 mrg #define LE 280
298 1.1 mrg #define NE 281
299 1.1 mrg #define EQ 282
300 1.1 mrg #define RSHIFT 283
301 1.1 mrg #define LSHIFT 284
302 1.1 mrg #define UMINUS 285
303 1.1 mrg
304 1.1 mrg
305 1.1 mrg
306 1.1 mrg #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
307 1.1 mrg typedef union YYSTYPE
308 1.1 mrg {
309 1.1.1.2 mrg /* Line 387 of yacc.c */
310 1.1.1.3 mrg #line 142 "../../../gmp/demos/calc/calc.y"
311 1.1 mrg
312 1.1 mrg char *str;
313 1.1 mrg int var;
314 1.1 mrg
315 1.1 mrg
316 1.1.1.2 mrg /* Line 387 of yacc.c */
317 1.1.1.2 mrg #line 318 "calc.c"
318 1.1 mrg } YYSTYPE;
319 1.1 mrg # define YYSTYPE_IS_TRIVIAL 1
320 1.1 mrg # define yystype YYSTYPE /* obsolescent; will be withdrawn */
321 1.1 mrg # define YYSTYPE_IS_DECLARED 1
322 1.1 mrg #endif
323 1.1 mrg
324 1.1.1.2 mrg extern YYSTYPE yylval;
325 1.1 mrg
326 1.1.1.2 mrg #ifdef YYPARSE_PARAM
327 1.1.1.2 mrg #if defined __STDC__ || defined __cplusplus
328 1.1.1.2 mrg int yyparse (void *YYPARSE_PARAM);
329 1.1.1.2 mrg #else
330 1.1.1.2 mrg int yyparse ();
331 1.1.1.2 mrg #endif
332 1.1.1.2 mrg #else /* ! YYPARSE_PARAM */
333 1.1.1.2 mrg #if defined __STDC__ || defined __cplusplus
334 1.1.1.2 mrg int yyparse (void);
335 1.1.1.2 mrg #else
336 1.1.1.2 mrg int yyparse ();
337 1.1.1.2 mrg #endif
338 1.1.1.2 mrg #endif /* ! YYPARSE_PARAM */
339 1.1.1.2 mrg
340 1.1.1.3 mrg #endif /* !YY_YY_CALC_H_INCLUDED */
341 1.1 mrg
342 1.1.1.2 mrg /* Copy the second part of user declarations. */
343 1.1 mrg
344 1.1.1.2 mrg /* Line 390 of yacc.c */
345 1.1.1.2 mrg #line 346 "calc.c"
346 1.1 mrg
347 1.1 mrg #ifdef short
348 1.1 mrg # undef short
349 1.1 mrg #endif
350 1.1 mrg
351 1.1 mrg #ifdef YYTYPE_UINT8
352 1.1 mrg typedef YYTYPE_UINT8 yytype_uint8;
353 1.1 mrg #else
354 1.1 mrg typedef unsigned char yytype_uint8;
355 1.1 mrg #endif
356 1.1 mrg
357 1.1 mrg #ifdef YYTYPE_INT8
358 1.1 mrg typedef YYTYPE_INT8 yytype_int8;
359 1.1 mrg #elif (defined __STDC__ || defined __C99__FUNC__ \
360 1.1 mrg || defined __cplusplus || defined _MSC_VER)
361 1.1 mrg typedef signed char yytype_int8;
362 1.1 mrg #else
363 1.1 mrg typedef short int yytype_int8;
364 1.1 mrg #endif
365 1.1 mrg
366 1.1 mrg #ifdef YYTYPE_UINT16
367 1.1 mrg typedef YYTYPE_UINT16 yytype_uint16;
368 1.1 mrg #else
369 1.1 mrg typedef unsigned short int yytype_uint16;
370 1.1 mrg #endif
371 1.1 mrg
372 1.1 mrg #ifdef YYTYPE_INT16
373 1.1 mrg typedef YYTYPE_INT16 yytype_int16;
374 1.1 mrg #else
375 1.1 mrg typedef short int yytype_int16;
376 1.1 mrg #endif
377 1.1 mrg
378 1.1 mrg #ifndef YYSIZE_T
379 1.1 mrg # ifdef __SIZE_TYPE__
380 1.1 mrg # define YYSIZE_T __SIZE_TYPE__
381 1.1 mrg # elif defined size_t
382 1.1 mrg # define YYSIZE_T size_t
383 1.1 mrg # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
384 1.1 mrg || defined __cplusplus || defined _MSC_VER)
385 1.1 mrg # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
386 1.1 mrg # define YYSIZE_T size_t
387 1.1 mrg # else
388 1.1 mrg # define YYSIZE_T unsigned int
389 1.1 mrg # endif
390 1.1 mrg #endif
391 1.1 mrg
392 1.1 mrg #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
393 1.1 mrg
394 1.1 mrg #ifndef YY_
395 1.1 mrg # if defined YYENABLE_NLS && YYENABLE_NLS
396 1.1 mrg # if ENABLE_NLS
397 1.1 mrg # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
398 1.1.1.2 mrg # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
399 1.1 mrg # endif
400 1.1 mrg # endif
401 1.1 mrg # ifndef YY_
402 1.1.1.2 mrg # define YY_(Msgid) Msgid
403 1.1.1.2 mrg # endif
404 1.1.1.2 mrg #endif
405 1.1.1.2 mrg
406 1.1.1.2 mrg #ifndef __attribute__
407 1.1.1.2 mrg /* This feature is available in gcc versions 2.5 and later. */
408 1.1.1.2 mrg # if (! defined __GNUC__ || __GNUC__ < 2 \
409 1.1.1.2 mrg || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
410 1.1.1.2 mrg # define __attribute__(Spec) /* empty */
411 1.1 mrg # endif
412 1.1 mrg #endif
413 1.1 mrg
414 1.1 mrg /* Suppress unused-variable warnings by "using" E. */
415 1.1 mrg #if ! defined lint || defined __GNUC__
416 1.1.1.2 mrg # define YYUSE(E) ((void) (E))
417 1.1 mrg #else
418 1.1.1.2 mrg # define YYUSE(E) /* empty */
419 1.1 mrg #endif
420 1.1 mrg
421 1.1.1.2 mrg
422 1.1 mrg /* Identity function, used to suppress warnings about constant conditions. */
423 1.1 mrg #ifndef lint
424 1.1.1.2 mrg # define YYID(N) (N)
425 1.1 mrg #else
426 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
427 1.1 mrg || defined __cplusplus || defined _MSC_VER)
428 1.1 mrg static int
429 1.1 mrg YYID (int yyi)
430 1.1 mrg #else
431 1.1 mrg static int
432 1.1 mrg YYID (yyi)
433 1.1 mrg int yyi;
434 1.1 mrg #endif
435 1.1 mrg {
436 1.1 mrg return yyi;
437 1.1 mrg }
438 1.1 mrg #endif
439 1.1 mrg
440 1.1 mrg #if ! defined yyoverflow || YYERROR_VERBOSE
441 1.1 mrg
442 1.1 mrg /* The parser invokes alloca or malloc; define the necessary symbols. */
443 1.1 mrg
444 1.1 mrg # ifdef YYSTACK_USE_ALLOCA
445 1.1 mrg # if YYSTACK_USE_ALLOCA
446 1.1 mrg # ifdef __GNUC__
447 1.1 mrg # define YYSTACK_ALLOC __builtin_alloca
448 1.1 mrg # elif defined __BUILTIN_VA_ARG_INCR
449 1.1 mrg # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
450 1.1 mrg # elif defined _AIX
451 1.1 mrg # define YYSTACK_ALLOC __alloca
452 1.1 mrg # elif defined _MSC_VER
453 1.1 mrg # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
454 1.1 mrg # define alloca _alloca
455 1.1 mrg # else
456 1.1 mrg # define YYSTACK_ALLOC alloca
457 1.1.1.2 mrg # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
458 1.1 mrg || defined __cplusplus || defined _MSC_VER)
459 1.1 mrg # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
460 1.1.1.2 mrg /* Use EXIT_SUCCESS as a witness for stdlib.h. */
461 1.1.1.2 mrg # ifndef EXIT_SUCCESS
462 1.1.1.2 mrg # define EXIT_SUCCESS 0
463 1.1 mrg # endif
464 1.1 mrg # endif
465 1.1 mrg # endif
466 1.1 mrg # endif
467 1.1 mrg # endif
468 1.1 mrg
469 1.1 mrg # ifdef YYSTACK_ALLOC
470 1.1 mrg /* Pacify GCC's `empty if-body' warning. */
471 1.1 mrg # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
472 1.1 mrg # ifndef YYSTACK_ALLOC_MAXIMUM
473 1.1 mrg /* The OS might guarantee only one guard page at the bottom of the stack,
474 1.1 mrg and a page size can be as small as 4096 bytes. So we cannot safely
475 1.1 mrg invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
476 1.1 mrg to allow for a few compiler-allocated temporary stack slots. */
477 1.1 mrg # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
478 1.1 mrg # endif
479 1.1 mrg # else
480 1.1 mrg # define YYSTACK_ALLOC YYMALLOC
481 1.1 mrg # define YYSTACK_FREE YYFREE
482 1.1 mrg # ifndef YYSTACK_ALLOC_MAXIMUM
483 1.1 mrg # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
484 1.1 mrg # endif
485 1.1.1.2 mrg # if (defined __cplusplus && ! defined EXIT_SUCCESS \
486 1.1 mrg && ! ((defined YYMALLOC || defined malloc) \
487 1.1 mrg && (defined YYFREE || defined free)))
488 1.1 mrg # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
489 1.1.1.2 mrg # ifndef EXIT_SUCCESS
490 1.1.1.2 mrg # define EXIT_SUCCESS 0
491 1.1 mrg # endif
492 1.1 mrg # endif
493 1.1 mrg # ifndef YYMALLOC
494 1.1 mrg # define YYMALLOC malloc
495 1.1.1.2 mrg # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
496 1.1 mrg || defined __cplusplus || defined _MSC_VER)
497 1.1 mrg void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
498 1.1 mrg # endif
499 1.1 mrg # endif
500 1.1 mrg # ifndef YYFREE
501 1.1 mrg # define YYFREE free
502 1.1.1.2 mrg # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
503 1.1 mrg || defined __cplusplus || defined _MSC_VER)
504 1.1 mrg void free (void *); /* INFRINGES ON USER NAME SPACE */
505 1.1 mrg # endif
506 1.1 mrg # endif
507 1.1 mrg # endif
508 1.1 mrg #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
509 1.1 mrg
510 1.1 mrg
511 1.1 mrg #if (! defined yyoverflow \
512 1.1 mrg && (! defined __cplusplus \
513 1.1 mrg || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
514 1.1 mrg
515 1.1 mrg /* A type that is properly aligned for any stack member. */
516 1.1 mrg union yyalloc
517 1.1 mrg {
518 1.1 mrg yytype_int16 yyss_alloc;
519 1.1 mrg YYSTYPE yyvs_alloc;
520 1.1 mrg };
521 1.1 mrg
522 1.1 mrg /* The size of the maximum gap between one aligned stack and the next. */
523 1.1 mrg # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
524 1.1 mrg
525 1.1 mrg /* The size of an array large to enough to hold all stacks, each with
526 1.1 mrg N elements. */
527 1.1 mrg # define YYSTACK_BYTES(N) \
528 1.1 mrg ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
529 1.1 mrg + YYSTACK_GAP_MAXIMUM)
530 1.1 mrg
531 1.1.1.2 mrg # define YYCOPY_NEEDED 1
532 1.1 mrg
533 1.1 mrg /* Relocate STACK from its old location to the new one. The
534 1.1 mrg local variables YYSIZE and YYSTACKSIZE give the old and new number of
535 1.1 mrg elements in the stack, and YYPTR gives the new location of the
536 1.1 mrg stack. Advance YYPTR to a properly aligned location for the next
537 1.1 mrg stack. */
538 1.1 mrg # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
539 1.1 mrg do \
540 1.1 mrg { \
541 1.1 mrg YYSIZE_T yynewbytes; \
542 1.1 mrg YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
543 1.1 mrg Stack = &yyptr->Stack_alloc; \
544 1.1 mrg yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
545 1.1 mrg yyptr += yynewbytes / sizeof (*yyptr); \
546 1.1 mrg } \
547 1.1 mrg while (YYID (0))
548 1.1 mrg
549 1.1 mrg #endif
550 1.1 mrg
551 1.1.1.2 mrg #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
552 1.1.1.2 mrg /* Copy COUNT objects from SRC to DST. The source and destination do
553 1.1.1.2 mrg not overlap. */
554 1.1.1.2 mrg # ifndef YYCOPY
555 1.1.1.2 mrg # if defined __GNUC__ && 1 < __GNUC__
556 1.1.1.2 mrg # define YYCOPY(Dst, Src, Count) \
557 1.1.1.2 mrg __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
558 1.1.1.2 mrg # else
559 1.1.1.2 mrg # define YYCOPY(Dst, Src, Count) \
560 1.1.1.2 mrg do \
561 1.1.1.2 mrg { \
562 1.1.1.2 mrg YYSIZE_T yyi; \
563 1.1.1.2 mrg for (yyi = 0; yyi < (Count); yyi++) \
564 1.1.1.2 mrg (Dst)[yyi] = (Src)[yyi]; \
565 1.1.1.2 mrg } \
566 1.1.1.2 mrg while (YYID (0))
567 1.1.1.2 mrg # endif
568 1.1.1.2 mrg # endif
569 1.1.1.2 mrg #endif /* !YYCOPY_NEEDED */
570 1.1.1.2 mrg
571 1.1 mrg /* YYFINAL -- State number of the termination state. */
572 1.1 mrg #define YYFINAL 41
573 1.1 mrg /* YYLAST -- Last index in YYTABLE. */
574 1.1 mrg #define YYLAST 552
575 1.1 mrg
576 1.1 mrg /* YYNTOKENS -- Number of terminals. */
577 1.1 mrg #define YYNTOKENS 44
578 1.1 mrg /* YYNNTS -- Number of nonterminals. */
579 1.1 mrg #define YYNNTS 7
580 1.1 mrg /* YYNRULES -- Number of rules. */
581 1.1 mrg #define YYNRULES 49
582 1.1 mrg /* YYNRULES -- Number of states. */
583 1.1 mrg #define YYNSTATES 118
584 1.1 mrg
585 1.1 mrg /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
586 1.1 mrg #define YYUNDEFTOK 2
587 1.1 mrg #define YYMAXUTOK 285
588 1.1 mrg
589 1.1 mrg #define YYTRANSLATE(YYX) \
590 1.1 mrg ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
591 1.1 mrg
592 1.1 mrg /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
593 1.1 mrg static const yytype_uint8 yytranslate[] =
594 1.1 mrg {
595 1.1 mrg 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 1.1 mrg 2, 2, 2, 39, 2, 2, 2, 36, 2, 2,
599 1.1 mrg 41, 42, 34, 32, 43, 33, 2, 35, 2, 2,
600 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 1.1 mrg 24, 40, 25, 2, 2, 2, 2, 2, 2, 2,
602 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
603 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
604 1.1 mrg 2, 2, 2, 2, 38, 2, 2, 2, 2, 2,
605 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
606 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
609 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
610 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
611 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
612 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
617 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 1.1 mrg 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 1.1 mrg 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
621 1.1 mrg 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
622 1.1 mrg 15, 16, 17, 18, 19, 20, 21, 22, 23, 26,
623 1.1 mrg 27, 28, 29, 30, 31, 37
624 1.1 mrg };
625 1.1 mrg
626 1.1 mrg #if YYDEBUG
627 1.1 mrg /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
628 1.1 mrg YYRHS. */
629 1.1 mrg static const yytype_uint8 yyprhs[] =
630 1.1 mrg {
631 1.1 mrg 0, 0, 3, 5, 8, 11, 15, 18, 19, 21,
632 1.1 mrg 25, 27, 29, 31, 33, 37, 41, 45, 49, 53,
633 1.1 mrg 57, 61, 65, 69, 72, 75, 79, 83, 87, 91,
634 1.1 mrg 95, 99, 103, 107, 112, 119, 124, 129, 136, 141,
635 1.1 mrg 146, 151, 160, 167, 172, 174, 176, 178, 182, 184
636 1.1 mrg };
637 1.1 mrg
638 1.1 mrg /* YYRHS -- A `-1'-separated list of the rules' RHS. */
639 1.1 mrg static const yytype_int8 yyrhs[] =
640 1.1 mrg {
641 1.1 mrg 45, 0, -1, 47, -1, 46, 47, -1, 47, 3,
642 1.1 mrg -1, 46, 47, 3, -1, 1, 3, -1, -1, 48,
643 1.1 mrg -1, 21, 40, 48, -1, 5, -1, 6, -1, 7,
644 1.1 mrg -1, 8, -1, 41, 48, 42, -1, 48, 32, 48,
645 1.1 mrg -1, 48, 33, 48, -1, 48, 34, 48, -1, 48,
646 1.1 mrg 35, 48, -1, 48, 36, 48, -1, 48, 38, 48,
647 1.1 mrg -1, 48, 31, 48, -1, 48, 30, 48, -1, 48,
648 1.1 mrg 39, -1, 33, 48, -1, 48, 24, 48, -1, 48,
649 1.1 mrg 27, 48, -1, 48, 29, 48, -1, 48, 28, 48,
650 1.1 mrg -1, 48, 26, 48, -1, 48, 25, 48, -1, 48,
651 1.1 mrg 23, 48, -1, 48, 22, 48, -1, 9, 41, 48,
652 1.1 mrg 42, -1, 10, 41, 48, 43, 48, 42, -1, 11,
653 1.1 mrg 41, 48, 42, -1, 12, 41, 49, 42, -1, 13,
654 1.1 mrg 41, 48, 43, 48, 42, -1, 14, 41, 50, 42,
655 1.1 mrg -1, 15, 41, 48, 42, -1, 16, 41, 48, 42,
656 1.1 mrg -1, 17, 41, 48, 43, 48, 43, 48, 42, -1,
657 1.1 mrg 18, 41, 48, 43, 48, 42, -1, 19, 41, 48,
658 1.1 mrg 42, -1, 21, -1, 20, -1, 48, -1, 49, 43,
659 1.1 mrg 48, -1, 48, -1, 50, 43, 48, -1
660 1.1 mrg };
661 1.1 mrg
662 1.1 mrg /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
663 1.1 mrg static const yytype_uint16 yyrline[] =
664 1.1 mrg {
665 1.1 mrg 0, 167, 167, 168, 171, 172, 173, 175, 177, 182,
666 1.1 mrg 188, 189, 190, 191, 197, 198, 199, 200, 201, 202,
667 1.1 mrg 203, 205, 207, 209, 211, 213, 214, 215, 216, 217,
668 1.1 mrg 218, 220, 221, 223, 224, 226, 228, 229, 231, 232,
669 1.1 mrg 234, 235, 236, 238, 240, 246, 257, 258, 261, 262
670 1.1 mrg };
671 1.1 mrg #endif
672 1.1 mrg
673 1.1.1.2 mrg #if YYDEBUG || YYERROR_VERBOSE || 0
674 1.1 mrg /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
675 1.1 mrg First, the terminals, then, starting at YYNTOKENS, nonterminals. */
676 1.1 mrg static const char *const yytname[] =
677 1.1 mrg {
678 1.1 mrg "$end", "error", "$undefined", "EOS", "BAD", "HELP", "HEX", "DECIMAL",
679 1.1 mrg "QUIT", "ABS", "BIN", "FIB", "GCD", "KRON", "LCM", "LUCNUM", "NEXTPRIME",
680 1.1 mrg "POWM", "ROOT", "SQRT", "NUMBER", "VARIABLE", "LOR", "LAND", "'<'",
681 1.1 mrg "'>'", "GE", "LE", "NE", "EQ", "RSHIFT", "LSHIFT", "'+'", "'-'", "'*'",
682 1.1 mrg "'/'", "'%'", "UMINUS", "'^'", "'!'", "'='", "'('", "')'", "','",
683 1.1.1.2 mrg "$accept", "top", "statements", "statement", "e", "gcdlist", "lcmlist", YY_NULL
684 1.1 mrg };
685 1.1 mrg #endif
686 1.1 mrg
687 1.1 mrg # ifdef YYPRINT
688 1.1 mrg /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
689 1.1 mrg token YYLEX-NUM. */
690 1.1 mrg static const yytype_uint16 yytoknum[] =
691 1.1 mrg {
692 1.1 mrg 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
693 1.1 mrg 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
694 1.1 mrg 275, 276, 277, 278, 60, 62, 279, 280, 281, 282,
695 1.1 mrg 283, 284, 43, 45, 42, 47, 37, 285, 94, 33,
696 1.1 mrg 61, 40, 41, 44
697 1.1 mrg };
698 1.1 mrg # endif
699 1.1 mrg
700 1.1 mrg /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
701 1.1 mrg static const yytype_uint8 yyr1[] =
702 1.1 mrg {
703 1.1 mrg 0, 44, 45, 45, 46, 46, 46, 47, 47, 47,
704 1.1 mrg 47, 47, 47, 47, 48, 48, 48, 48, 48, 48,
705 1.1 mrg 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
706 1.1 mrg 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
707 1.1 mrg 48, 48, 48, 48, 48, 48, 49, 49, 50, 50
708 1.1 mrg };
709 1.1 mrg
710 1.1 mrg /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
711 1.1 mrg static const yytype_uint8 yyr2[] =
712 1.1 mrg {
713 1.1 mrg 0, 2, 1, 2, 2, 3, 2, 0, 1, 3,
714 1.1 mrg 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
715 1.1 mrg 3, 3, 3, 2, 2, 3, 3, 3, 3, 3,
716 1.1 mrg 3, 3, 3, 4, 6, 4, 4, 6, 4, 4,
717 1.1 mrg 4, 8, 6, 4, 1, 1, 1, 3, 1, 3
718 1.1 mrg };
719 1.1 mrg
720 1.1.1.2 mrg /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
721 1.1.1.2 mrg Performed when YYTABLE doesn't specify something else to do. Zero
722 1.1 mrg means the default is an error. */
723 1.1 mrg static const yytype_uint8 yydefact[] =
724 1.1 mrg {
725 1.1 mrg 0, 0, 10, 11, 12, 13, 0, 0, 0, 0,
726 1.1 mrg 0, 0, 0, 0, 0, 0, 0, 45, 44, 0,
727 1.1 mrg 0, 0, 7, 2, 8, 6, 0, 0, 0, 0,
728 1.1 mrg 0, 0, 0, 0, 0, 0, 0, 0, 44, 24,
729 1.1 mrg 0, 1, 3, 4, 0, 0, 0, 0, 0, 0,
730 1.1 mrg 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
731 1.1 mrg 23, 0, 0, 0, 46, 0, 0, 48, 0, 0,
732 1.1 mrg 0, 0, 0, 0, 9, 14, 5, 32, 31, 25,
733 1.1 mrg 30, 29, 26, 28, 27, 22, 21, 15, 16, 17,
734 1.1 mrg 18, 19, 20, 33, 0, 35, 36, 0, 0, 38,
735 1.1 mrg 0, 39, 40, 0, 0, 43, 0, 47, 0, 49,
736 1.1 mrg 0, 0, 34, 37, 0, 42, 0, 41
737 1.1 mrg };
738 1.1 mrg
739 1.1 mrg /* YYDEFGOTO[NTERM-NUM]. */
740 1.1 mrg static const yytype_int8 yydefgoto[] =
741 1.1 mrg {
742 1.1 mrg -1, 21, 22, 23, 24, 65, 68
743 1.1 mrg };
744 1.1 mrg
745 1.1 mrg /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
746 1.1 mrg STATE-NUM. */
747 1.1 mrg #define YYPACT_NINF -39
748 1.1 mrg static const yytype_int16 yypact[] =
749 1.1 mrg {
750 1.1 mrg 41, 3, -39, -39, -39, -39, 2, 4, 27, 32,
751 1.1 mrg 35, 36, 39, 42, 45, 46, 47, -39, -18, 124,
752 1.1 mrg 124, 89, 91, 87, 464, -39, 124, 124, 124, 124,
753 1.1 mrg 124, 124, 124, 124, 124, 124, 124, 124, -39, -36,
754 1.1 mrg 254, -39, 88, -39, 124, 124, 124, 124, 124, 124,
755 1.1 mrg 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
756 1.1 mrg -39, 275, 144, 296, 464, -38, 166, 464, 29, 317,
757 1.1 mrg 338, 188, 210, 359, 464, -39, -39, 481, 497, 513,
758 1.1 mrg 513, 513, 513, 513, 513, 31, 31, -15, -15, -36,
759 1.1 mrg -36, -36, -36, -39, 124, -39, -39, 124, 124, -39,
760 1.1 mrg 124, -39, -39, 124, 124, -39, 380, 464, 401, 464,
761 1.1 mrg 232, 422, -39, -39, 124, -39, 443, -39
762 1.1 mrg };
763 1.1 mrg
764 1.1 mrg /* YYPGOTO[NTERM-NUM]. */
765 1.1 mrg static const yytype_int8 yypgoto[] =
766 1.1 mrg {
767 1.1 mrg -39, -39, -39, 70, -19, -39, -39
768 1.1 mrg };
769 1.1 mrg
770 1.1 mrg /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
771 1.1 mrg positive, shift that token. If negative, reduce the rule which
772 1.1.1.2 mrg number is the opposite. If YYTABLE_NINF, syntax error. */
773 1.1 mrg #define YYTABLE_NINF -8
774 1.1 mrg static const yytype_int8 yytable[] =
775 1.1 mrg {
776 1.1 mrg 39, 40, 59, 60, 96, 97, 25, 61, 62, 63,
777 1.1 mrg 64, 66, 67, 69, 70, 71, 72, 73, 74, 56,
778 1.1 mrg 57, 58, 37, 59, 60, 77, 78, 79, 80, 81,
779 1.1 mrg 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
780 1.1 mrg 92, -7, 1, 26, -7, 27, 2, 3, 4, 5,
781 1.1 mrg 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
782 1.1 mrg 16, 17, 18, 54, 55, 56, 57, 58, 28, 59,
783 1.1 mrg 60, 99, 100, 29, 19, 106, 30, 31, 107, 108,
784 1.1 mrg 32, 109, 20, 33, 110, 111, 34, 35, 36, 41,
785 1.1 mrg 43, 76, 42, 0, 0, 116, 2, 3, 4, 5,
786 1.1 mrg 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
787 1.1 mrg 16, 17, 18, 0, 0, 0, 0, 0, 0, 0,
788 1.1 mrg 0, 0, 0, 0, 19, 0, 0, 0, 0, 0,
789 1.1 mrg 0, 0, 20, 6, 7, 8, 9, 10, 11, 12,
790 1.1 mrg 13, 14, 15, 16, 17, 38, 0, 0, 0, 0,
791 1.1 mrg 0, 0, 0, 0, 0, 0, 0, 19, 0, 0,
792 1.1 mrg 0, 0, 0, 0, 0, 20, 44, 45, 46, 47,
793 1.1 mrg 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
794 1.1 mrg 58, 0, 59, 60, 0, 0, 0, 94, 44, 45,
795 1.1 mrg 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
796 1.1 mrg 56, 57, 58, 0, 59, 60, 0, 0, 0, 98,
797 1.1 mrg 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
798 1.1 mrg 54, 55, 56, 57, 58, 0, 59, 60, 0, 0,
799 1.1 mrg 0, 103, 44, 45, 46, 47, 48, 49, 50, 51,
800 1.1 mrg 52, 53, 54, 55, 56, 57, 58, 0, 59, 60,
801 1.1 mrg 0, 0, 0, 104, 44, 45, 46, 47, 48, 49,
802 1.1 mrg 50, 51, 52, 53, 54, 55, 56, 57, 58, 0,
803 1.1 mrg 59, 60, 0, 0, 0, 114, 44, 45, 46, 47,
804 1.1 mrg 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
805 1.1 mrg 58, 0, 59, 60, 0, 0, 75, 44, 45, 46,
806 1.1 mrg 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
807 1.1 mrg 57, 58, 0, 59, 60, 0, 0, 93, 44, 45,
808 1.1 mrg 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
809 1.1 mrg 56, 57, 58, 0, 59, 60, 0, 0, 95, 44,
810 1.1 mrg 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
811 1.1 mrg 55, 56, 57, 58, 0, 59, 60, 0, 0, 101,
812 1.1 mrg 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
813 1.1 mrg 54, 55, 56, 57, 58, 0, 59, 60, 0, 0,
814 1.1 mrg 102, 44, 45, 46, 47, 48, 49, 50, 51, 52,
815 1.1 mrg 53, 54, 55, 56, 57, 58, 0, 59, 60, 0,
816 1.1 mrg 0, 105, 44, 45, 46, 47, 48, 49, 50, 51,
817 1.1 mrg 52, 53, 54, 55, 56, 57, 58, 0, 59, 60,
818 1.1 mrg 0, 0, 112, 44, 45, 46, 47, 48, 49, 50,
819 1.1 mrg 51, 52, 53, 54, 55, 56, 57, 58, 0, 59,
820 1.1 mrg 60, 0, 0, 113, 44, 45, 46, 47, 48, 49,
821 1.1 mrg 50, 51, 52, 53, 54, 55, 56, 57, 58, 0,
822 1.1 mrg 59, 60, 0, 0, 115, 44, 45, 46, 47, 48,
823 1.1 mrg 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
824 1.1 mrg 0, 59, 60, 0, 0, 117, 44, 45, 46, 47,
825 1.1 mrg 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
826 1.1 mrg 58, 0, 59, 60, 45, 46, 47, 48, 49, 50,
827 1.1 mrg 51, 52, 53, 54, 55, 56, 57, 58, 0, 59,
828 1.1 mrg 60, 46, 47, 48, 49, 50, 51, 52, 53, 54,
829 1.1 mrg 55, 56, 57, 58, 0, 59, 60, -8, -8, -8,
830 1.1 mrg -8, -8, -8, 52, 53, 54, 55, 56, 57, 58,
831 1.1 mrg 0, 59, 60
832 1.1 mrg };
833 1.1 mrg
834 1.1.1.2 mrg #define yypact_value_is_default(Yystate) \
835 1.1.1.2 mrg (!!((Yystate) == (-39)))
836 1.1.1.2 mrg
837 1.1.1.2 mrg #define yytable_value_is_error(Yytable_value) \
838 1.1.1.2 mrg (!!((Yytable_value) == (-8)))
839 1.1.1.2 mrg
840 1.1 mrg static const yytype_int8 yycheck[] =
841 1.1 mrg {
842 1.1 mrg 19, 20, 38, 39, 42, 43, 3, 26, 27, 28,
843 1.1 mrg 29, 30, 31, 32, 33, 34, 35, 36, 37, 34,
844 1.1 mrg 35, 36, 40, 38, 39, 44, 45, 46, 47, 48,
845 1.1 mrg 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
846 1.1 mrg 59, 0, 1, 41, 3, 41, 5, 6, 7, 8,
847 1.1 mrg 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
848 1.1 mrg 19, 20, 21, 32, 33, 34, 35, 36, 41, 38,
849 1.1 mrg 39, 42, 43, 41, 33, 94, 41, 41, 97, 98,
850 1.1 mrg 41, 100, 41, 41, 103, 104, 41, 41, 41, 0,
851 1.1 mrg 3, 3, 22, -1, -1, 114, 5, 6, 7, 8,
852 1.1 mrg 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
853 1.1 mrg 19, 20, 21, -1, -1, -1, -1, -1, -1, -1,
854 1.1 mrg -1, -1, -1, -1, 33, -1, -1, -1, -1, -1,
855 1.1 mrg -1, -1, 41, 9, 10, 11, 12, 13, 14, 15,
856 1.1 mrg 16, 17, 18, 19, 20, 21, -1, -1, -1, -1,
857 1.1 mrg -1, -1, -1, -1, -1, -1, -1, 33, -1, -1,
858 1.1 mrg -1, -1, -1, -1, -1, 41, 22, 23, 24, 25,
859 1.1 mrg 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
860 1.1 mrg 36, -1, 38, 39, -1, -1, -1, 43, 22, 23,
861 1.1 mrg 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
862 1.1 mrg 34, 35, 36, -1, 38, 39, -1, -1, -1, 43,
863 1.1 mrg 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
864 1.1 mrg 32, 33, 34, 35, 36, -1, 38, 39, -1, -1,
865 1.1 mrg -1, 43, 22, 23, 24, 25, 26, 27, 28, 29,
866 1.1 mrg 30, 31, 32, 33, 34, 35, 36, -1, 38, 39,
867 1.1 mrg -1, -1, -1, 43, 22, 23, 24, 25, 26, 27,
868 1.1 mrg 28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
869 1.1 mrg 38, 39, -1, -1, -1, 43, 22, 23, 24, 25,
870 1.1 mrg 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
871 1.1 mrg 36, -1, 38, 39, -1, -1, 42, 22, 23, 24,
872 1.1 mrg 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
873 1.1 mrg 35, 36, -1, 38, 39, -1, -1, 42, 22, 23,
874 1.1 mrg 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
875 1.1 mrg 34, 35, 36, -1, 38, 39, -1, -1, 42, 22,
876 1.1 mrg 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
877 1.1 mrg 33, 34, 35, 36, -1, 38, 39, -1, -1, 42,
878 1.1 mrg 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
879 1.1 mrg 32, 33, 34, 35, 36, -1, 38, 39, -1, -1,
880 1.1 mrg 42, 22, 23, 24, 25, 26, 27, 28, 29, 30,
881 1.1 mrg 31, 32, 33, 34, 35, 36, -1, 38, 39, -1,
882 1.1 mrg -1, 42, 22, 23, 24, 25, 26, 27, 28, 29,
883 1.1 mrg 30, 31, 32, 33, 34, 35, 36, -1, 38, 39,
884 1.1 mrg -1, -1, 42, 22, 23, 24, 25, 26, 27, 28,
885 1.1 mrg 29, 30, 31, 32, 33, 34, 35, 36, -1, 38,
886 1.1 mrg 39, -1, -1, 42, 22, 23, 24, 25, 26, 27,
887 1.1 mrg 28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
888 1.1 mrg 38, 39, -1, -1, 42, 22, 23, 24, 25, 26,
889 1.1 mrg 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
890 1.1 mrg -1, 38, 39, -1, -1, 42, 22, 23, 24, 25,
891 1.1 mrg 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
892 1.1 mrg 36, -1, 38, 39, 23, 24, 25, 26, 27, 28,
893 1.1 mrg 29, 30, 31, 32, 33, 34, 35, 36, -1, 38,
894 1.1 mrg 39, 24, 25, 26, 27, 28, 29, 30, 31, 32,
895 1.1 mrg 33, 34, 35, 36, -1, 38, 39, 24, 25, 26,
896 1.1 mrg 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
897 1.1 mrg -1, 38, 39
898 1.1 mrg };
899 1.1 mrg
900 1.1 mrg /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
901 1.1 mrg symbol of state STATE-NUM. */
902 1.1 mrg static const yytype_uint8 yystos[] =
903 1.1 mrg {
904 1.1 mrg 0, 1, 5, 6, 7, 8, 9, 10, 11, 12,
905 1.1 mrg 13, 14, 15, 16, 17, 18, 19, 20, 21, 33,
906 1.1 mrg 41, 45, 46, 47, 48, 3, 41, 41, 41, 41,
907 1.1 mrg 41, 41, 41, 41, 41, 41, 41, 40, 21, 48,
908 1.1 mrg 48, 0, 47, 3, 22, 23, 24, 25, 26, 27,
909 1.1 mrg 28, 29, 30, 31, 32, 33, 34, 35, 36, 38,
910 1.1 mrg 39, 48, 48, 48, 48, 49, 48, 48, 50, 48,
911 1.1 mrg 48, 48, 48, 48, 48, 42, 3, 48, 48, 48,
912 1.1 mrg 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
913 1.1 mrg 48, 48, 48, 42, 43, 42, 42, 43, 43, 42,
914 1.1 mrg 43, 42, 42, 43, 43, 42, 48, 48, 48, 48,
915 1.1 mrg 48, 48, 42, 42, 43, 42, 48, 42
916 1.1 mrg };
917 1.1 mrg
918 1.1 mrg #define yyerrok (yyerrstatus = 0)
919 1.1 mrg #define yyclearin (yychar = YYEMPTY)
920 1.1 mrg #define YYEMPTY (-2)
921 1.1 mrg #define YYEOF 0
922 1.1 mrg
923 1.1 mrg #define YYACCEPT goto yyacceptlab
924 1.1 mrg #define YYABORT goto yyabortlab
925 1.1 mrg #define YYERROR goto yyerrorlab
926 1.1 mrg
927 1.1 mrg
928 1.1 mrg /* Like YYERROR except do call yyerror. This remains here temporarily
929 1.1 mrg to ease the transition to the new meaning of YYERROR, for GCC.
930 1.1 mrg Once GCC version 2 has supplanted version 1, this can go. However,
931 1.1 mrg YYFAIL appears to be in use. Nevertheless, it is formally deprecated
932 1.1 mrg in Bison 2.4.2's NEWS entry, where a plan to phase it out is
933 1.1 mrg discussed. */
934 1.1 mrg
935 1.1 mrg #define YYFAIL goto yyerrlab
936 1.1 mrg #if defined YYFAIL
937 1.1 mrg /* This is here to suppress warnings from the GCC cpp's
938 1.1 mrg -Wunused-macros. Normally we don't worry about that warning, but
939 1.1 mrg some users do, and we want to make it easy for users to remove
940 1.1 mrg YYFAIL uses, which will produce warnings from Bison 2.5. */
941 1.1 mrg #endif
942 1.1 mrg
943 1.1 mrg #define YYRECOVERING() (!!yyerrstatus)
944 1.1 mrg
945 1.1.1.2 mrg #define YYBACKUP(Token, Value) \
946 1.1.1.2 mrg do \
947 1.1.1.2 mrg if (yychar == YYEMPTY) \
948 1.1.1.2 mrg { \
949 1.1.1.2 mrg yychar = (Token); \
950 1.1.1.2 mrg yylval = (Value); \
951 1.1.1.2 mrg YYPOPSTACK (yylen); \
952 1.1.1.2 mrg yystate = *yyssp; \
953 1.1.1.2 mrg goto yybackup; \
954 1.1.1.2 mrg } \
955 1.1.1.2 mrg else \
956 1.1.1.2 mrg { \
957 1.1 mrg yyerror (YY_("syntax error: cannot back up")); \
958 1.1 mrg YYERROR; \
959 1.1 mrg } \
960 1.1 mrg while (YYID (0))
961 1.1 mrg
962 1.1.1.2 mrg /* Error token number */
963 1.1 mrg #define YYTERROR 1
964 1.1 mrg #define YYERRCODE 256
965 1.1 mrg
966 1.1 mrg
967 1.1.1.2 mrg /* This macro is provided for backward compatibility. */
968 1.1 mrg #ifndef YY_LOCATION_PRINT
969 1.1.1.2 mrg # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
970 1.1 mrg #endif
971 1.1 mrg
972 1.1 mrg
973 1.1 mrg /* YYLEX -- calling `yylex' with the right arguments. */
974 1.1 mrg #ifdef YYLEX_PARAM
975 1.1 mrg # define YYLEX yylex (YYLEX_PARAM)
976 1.1 mrg #else
977 1.1 mrg # define YYLEX yylex ()
978 1.1 mrg #endif
979 1.1 mrg
980 1.1 mrg /* Enable debugging if requested. */
981 1.1 mrg #if YYDEBUG
982 1.1 mrg
983 1.1 mrg # ifndef YYFPRINTF
984 1.1 mrg # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
985 1.1 mrg # define YYFPRINTF fprintf
986 1.1 mrg # endif
987 1.1 mrg
988 1.1 mrg # define YYDPRINTF(Args) \
989 1.1 mrg do { \
990 1.1 mrg if (yydebug) \
991 1.1 mrg YYFPRINTF Args; \
992 1.1 mrg } while (YYID (0))
993 1.1 mrg
994 1.1 mrg # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
995 1.1 mrg do { \
996 1.1 mrg if (yydebug) \
997 1.1 mrg { \
998 1.1 mrg YYFPRINTF (stderr, "%s ", Title); \
999 1.1 mrg yy_symbol_print (stderr, \
1000 1.1 mrg Type, Value); \
1001 1.1 mrg YYFPRINTF (stderr, "\n"); \
1002 1.1 mrg } \
1003 1.1 mrg } while (YYID (0))
1004 1.1 mrg
1005 1.1 mrg
1006 1.1 mrg /*--------------------------------.
1007 1.1 mrg | Print this symbol on YYOUTPUT. |
1008 1.1 mrg `--------------------------------*/
1009 1.1 mrg
1010 1.1 mrg /*ARGSUSED*/
1011 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
1012 1.1 mrg || defined __cplusplus || defined _MSC_VER)
1013 1.1 mrg static void
1014 1.1 mrg yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1015 1.1 mrg #else
1016 1.1 mrg static void
1017 1.1 mrg yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1018 1.1 mrg FILE *yyoutput;
1019 1.1 mrg int yytype;
1020 1.1 mrg YYSTYPE const * const yyvaluep;
1021 1.1 mrg #endif
1022 1.1 mrg {
1023 1.1.1.2 mrg FILE *yyo = yyoutput;
1024 1.1.1.2 mrg YYUSE (yyo);
1025 1.1 mrg if (!yyvaluep)
1026 1.1 mrg return;
1027 1.1 mrg # ifdef YYPRINT
1028 1.1 mrg if (yytype < YYNTOKENS)
1029 1.1 mrg YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1030 1.1 mrg # else
1031 1.1 mrg YYUSE (yyoutput);
1032 1.1 mrg # endif
1033 1.1.1.2 mrg YYUSE (yytype);
1034 1.1 mrg }
1035 1.1 mrg
1036 1.1 mrg
1037 1.1 mrg /*--------------------------------.
1038 1.1 mrg | Print this symbol on YYOUTPUT. |
1039 1.1 mrg `--------------------------------*/
1040 1.1 mrg
1041 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
1042 1.1 mrg || defined __cplusplus || defined _MSC_VER)
1043 1.1 mrg static void
1044 1.1 mrg yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1045 1.1 mrg #else
1046 1.1 mrg static void
1047 1.1 mrg yy_symbol_print (yyoutput, yytype, yyvaluep)
1048 1.1 mrg FILE *yyoutput;
1049 1.1 mrg int yytype;
1050 1.1 mrg YYSTYPE const * const yyvaluep;
1051 1.1 mrg #endif
1052 1.1 mrg {
1053 1.1 mrg if (yytype < YYNTOKENS)
1054 1.1 mrg YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1055 1.1 mrg else
1056 1.1 mrg YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1057 1.1 mrg
1058 1.1 mrg yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1059 1.1 mrg YYFPRINTF (yyoutput, ")");
1060 1.1 mrg }
1061 1.1 mrg
1062 1.1 mrg /*------------------------------------------------------------------.
1063 1.1 mrg | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1064 1.1 mrg | TOP (included). |
1065 1.1 mrg `------------------------------------------------------------------*/
1066 1.1 mrg
1067 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
1068 1.1 mrg || defined __cplusplus || defined _MSC_VER)
1069 1.1 mrg static void
1070 1.1 mrg yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1071 1.1 mrg #else
1072 1.1 mrg static void
1073 1.1 mrg yy_stack_print (yybottom, yytop)
1074 1.1 mrg yytype_int16 *yybottom;
1075 1.1 mrg yytype_int16 *yytop;
1076 1.1 mrg #endif
1077 1.1 mrg {
1078 1.1 mrg YYFPRINTF (stderr, "Stack now");
1079 1.1 mrg for (; yybottom <= yytop; yybottom++)
1080 1.1 mrg {
1081 1.1 mrg int yybot = *yybottom;
1082 1.1 mrg YYFPRINTF (stderr, " %d", yybot);
1083 1.1 mrg }
1084 1.1 mrg YYFPRINTF (stderr, "\n");
1085 1.1 mrg }
1086 1.1 mrg
1087 1.1 mrg # define YY_STACK_PRINT(Bottom, Top) \
1088 1.1 mrg do { \
1089 1.1 mrg if (yydebug) \
1090 1.1 mrg yy_stack_print ((Bottom), (Top)); \
1091 1.1 mrg } while (YYID (0))
1092 1.1 mrg
1093 1.1 mrg
1094 1.1 mrg /*------------------------------------------------.
1095 1.1 mrg | Report that the YYRULE is going to be reduced. |
1096 1.1 mrg `------------------------------------------------*/
1097 1.1 mrg
1098 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
1099 1.1 mrg || defined __cplusplus || defined _MSC_VER)
1100 1.1 mrg static void
1101 1.1 mrg yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1102 1.1 mrg #else
1103 1.1 mrg static void
1104 1.1 mrg yy_reduce_print (yyvsp, yyrule)
1105 1.1 mrg YYSTYPE *yyvsp;
1106 1.1 mrg int yyrule;
1107 1.1 mrg #endif
1108 1.1 mrg {
1109 1.1 mrg int yynrhs = yyr2[yyrule];
1110 1.1 mrg int yyi;
1111 1.1 mrg unsigned long int yylno = yyrline[yyrule];
1112 1.1 mrg YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1113 1.1 mrg yyrule - 1, yylno);
1114 1.1 mrg /* The symbols being reduced. */
1115 1.1 mrg for (yyi = 0; yyi < yynrhs; yyi++)
1116 1.1 mrg {
1117 1.1 mrg YYFPRINTF (stderr, " $%d = ", yyi + 1);
1118 1.1 mrg yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1119 1.1 mrg &(yyvsp[(yyi + 1) - (yynrhs)])
1120 1.1 mrg );
1121 1.1 mrg YYFPRINTF (stderr, "\n");
1122 1.1 mrg }
1123 1.1 mrg }
1124 1.1 mrg
1125 1.1 mrg # define YY_REDUCE_PRINT(Rule) \
1126 1.1 mrg do { \
1127 1.1 mrg if (yydebug) \
1128 1.1 mrg yy_reduce_print (yyvsp, Rule); \
1129 1.1 mrg } while (YYID (0))
1130 1.1 mrg
1131 1.1 mrg /* Nonzero means print parse trace. It is left uninitialized so that
1132 1.1 mrg multiple parsers can coexist. */
1133 1.1 mrg int yydebug;
1134 1.1 mrg #else /* !YYDEBUG */
1135 1.1 mrg # define YYDPRINTF(Args)
1136 1.1 mrg # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1137 1.1 mrg # define YY_STACK_PRINT(Bottom, Top)
1138 1.1 mrg # define YY_REDUCE_PRINT(Rule)
1139 1.1 mrg #endif /* !YYDEBUG */
1140 1.1 mrg
1141 1.1 mrg
1142 1.1 mrg /* YYINITDEPTH -- initial size of the parser's stacks. */
1143 1.1 mrg #ifndef YYINITDEPTH
1144 1.1 mrg # define YYINITDEPTH 200
1145 1.1 mrg #endif
1146 1.1 mrg
1147 1.1 mrg /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1148 1.1 mrg if the built-in stack extension method is used).
1149 1.1 mrg
1150 1.1 mrg Do not make this value too large; the results are undefined if
1151 1.1 mrg YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1152 1.1 mrg evaluated with infinite-precision integer arithmetic. */
1153 1.1 mrg
1154 1.1 mrg #ifndef YYMAXDEPTH
1155 1.1 mrg # define YYMAXDEPTH 10000
1156 1.1 mrg #endif
1157 1.1 mrg
1158 1.1 mrg
1159 1.1 mrg #if YYERROR_VERBOSE
1160 1.1 mrg
1161 1.1 mrg # ifndef yystrlen
1162 1.1 mrg # if defined __GLIBC__ && defined _STRING_H
1163 1.1 mrg # define yystrlen strlen
1164 1.1 mrg # else
1165 1.1 mrg /* Return the length of YYSTR. */
1166 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
1167 1.1 mrg || defined __cplusplus || defined _MSC_VER)
1168 1.1 mrg static YYSIZE_T
1169 1.1 mrg yystrlen (const char *yystr)
1170 1.1 mrg #else
1171 1.1 mrg static YYSIZE_T
1172 1.1 mrg yystrlen (yystr)
1173 1.1 mrg const char *yystr;
1174 1.1 mrg #endif
1175 1.1 mrg {
1176 1.1 mrg YYSIZE_T yylen;
1177 1.1 mrg for (yylen = 0; yystr[yylen]; yylen++)
1178 1.1 mrg continue;
1179 1.1 mrg return yylen;
1180 1.1 mrg }
1181 1.1 mrg # endif
1182 1.1 mrg # endif
1183 1.1 mrg
1184 1.1 mrg # ifndef yystpcpy
1185 1.1 mrg # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1186 1.1 mrg # define yystpcpy stpcpy
1187 1.1 mrg # else
1188 1.1 mrg /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1189 1.1 mrg YYDEST. */
1190 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
1191 1.1 mrg || defined __cplusplus || defined _MSC_VER)
1192 1.1 mrg static char *
1193 1.1 mrg yystpcpy (char *yydest, const char *yysrc)
1194 1.1 mrg #else
1195 1.1 mrg static char *
1196 1.1 mrg yystpcpy (yydest, yysrc)
1197 1.1 mrg char *yydest;
1198 1.1 mrg const char *yysrc;
1199 1.1 mrg #endif
1200 1.1 mrg {
1201 1.1 mrg char *yyd = yydest;
1202 1.1 mrg const char *yys = yysrc;
1203 1.1 mrg
1204 1.1 mrg while ((*yyd++ = *yys++) != '\0')
1205 1.1 mrg continue;
1206 1.1 mrg
1207 1.1 mrg return yyd - 1;
1208 1.1 mrg }
1209 1.1 mrg # endif
1210 1.1 mrg # endif
1211 1.1 mrg
1212 1.1 mrg # ifndef yytnamerr
1213 1.1 mrg /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1214 1.1 mrg quotes and backslashes, so that it's suitable for yyerror. The
1215 1.1 mrg heuristic is that double-quoting is unnecessary unless the string
1216 1.1 mrg contains an apostrophe, a comma, or backslash (other than
1217 1.1 mrg backslash-backslash). YYSTR is taken from yytname. If YYRES is
1218 1.1 mrg null, do not copy; instead, return the length of what the result
1219 1.1 mrg would have been. */
1220 1.1 mrg static YYSIZE_T
1221 1.1 mrg yytnamerr (char *yyres, const char *yystr)
1222 1.1 mrg {
1223 1.1 mrg if (*yystr == '"')
1224 1.1 mrg {
1225 1.1 mrg YYSIZE_T yyn = 0;
1226 1.1 mrg char const *yyp = yystr;
1227 1.1 mrg
1228 1.1 mrg for (;;)
1229 1.1 mrg switch (*++yyp)
1230 1.1 mrg {
1231 1.1 mrg case '\'':
1232 1.1 mrg case ',':
1233 1.1 mrg goto do_not_strip_quotes;
1234 1.1 mrg
1235 1.1 mrg case '\\':
1236 1.1 mrg if (*++yyp != '\\')
1237 1.1 mrg goto do_not_strip_quotes;
1238 1.1 mrg /* Fall through. */
1239 1.1 mrg default:
1240 1.1 mrg if (yyres)
1241 1.1 mrg yyres[yyn] = *yyp;
1242 1.1 mrg yyn++;
1243 1.1 mrg break;
1244 1.1 mrg
1245 1.1 mrg case '"':
1246 1.1 mrg if (yyres)
1247 1.1 mrg yyres[yyn] = '\0';
1248 1.1 mrg return yyn;
1249 1.1 mrg }
1250 1.1 mrg do_not_strip_quotes: ;
1251 1.1 mrg }
1252 1.1 mrg
1253 1.1 mrg if (! yyres)
1254 1.1 mrg return yystrlen (yystr);
1255 1.1 mrg
1256 1.1 mrg return yystpcpy (yyres, yystr) - yyres;
1257 1.1 mrg }
1258 1.1 mrg # endif
1259 1.1 mrg
1260 1.1.1.2 mrg /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1261 1.1.1.2 mrg about the unexpected token YYTOKEN for the state stack whose top is
1262 1.1.1.2 mrg YYSSP.
1263 1.1.1.2 mrg
1264 1.1.1.2 mrg Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1265 1.1.1.2 mrg not large enough to hold the message. In that case, also set
1266 1.1.1.2 mrg *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1267 1.1.1.2 mrg required number of bytes is too large to store. */
1268 1.1.1.2 mrg static int
1269 1.1.1.2 mrg yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1270 1.1.1.2 mrg yytype_int16 *yyssp, int yytoken)
1271 1.1 mrg {
1272 1.1.1.2 mrg YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
1273 1.1.1.2 mrg YYSIZE_T yysize = yysize0;
1274 1.1.1.2 mrg enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1275 1.1.1.2 mrg /* Internationalized format string. */
1276 1.1.1.2 mrg const char *yyformat = YY_NULL;
1277 1.1.1.2 mrg /* Arguments of yyformat. */
1278 1.1.1.2 mrg char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1279 1.1.1.2 mrg /* Number of reported tokens (one for the "unexpected", one per
1280 1.1.1.2 mrg "expected"). */
1281 1.1.1.2 mrg int yycount = 0;
1282 1.1.1.2 mrg
1283 1.1.1.2 mrg /* There are many possibilities here to consider:
1284 1.1.1.2 mrg - Assume YYFAIL is not used. It's too flawed to consider. See
1285 1.1.1.2 mrg <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1286 1.1.1.2 mrg for details. YYERROR is fine as it does not invoke this
1287 1.1.1.2 mrg function.
1288 1.1.1.2 mrg - If this state is a consistent state with a default action, then
1289 1.1.1.2 mrg the only way this function was invoked is if the default action
1290 1.1.1.2 mrg is an error action. In that case, don't check for expected
1291 1.1.1.2 mrg tokens because there are none.
1292 1.1.1.2 mrg - The only way there can be no lookahead present (in yychar) is if
1293 1.1.1.2 mrg this state is a consistent state with a default action. Thus,
1294 1.1.1.2 mrg detecting the absence of a lookahead is sufficient to determine
1295 1.1.1.2 mrg that there is no unexpected or expected token to report. In that
1296 1.1.1.2 mrg case, just report a simple "syntax error".
1297 1.1.1.2 mrg - Don't assume there isn't a lookahead just because this state is a
1298 1.1.1.2 mrg consistent state with a default action. There might have been a
1299 1.1.1.2 mrg previous inconsistent state, consistent state with a non-default
1300 1.1.1.2 mrg action, or user semantic action that manipulated yychar.
1301 1.1.1.2 mrg - Of course, the expected token list depends on states to have
1302 1.1.1.2 mrg correct lookahead information, and it depends on the parser not
1303 1.1.1.2 mrg to perform extra reductions after fetching a lookahead from the
1304 1.1.1.2 mrg scanner and before detecting a syntax error. Thus, state merging
1305 1.1.1.2 mrg (from LALR or IELR) and default reductions corrupt the expected
1306 1.1.1.2 mrg token list. However, the list is correct for canonical LR with
1307 1.1.1.2 mrg one exception: it will still contain any token that will not be
1308 1.1.1.2 mrg accepted due to an error action in a later state.
1309 1.1.1.2 mrg */
1310 1.1.1.2 mrg if (yytoken != YYEMPTY)
1311 1.1.1.2 mrg {
1312 1.1.1.2 mrg int yyn = yypact[*yyssp];
1313 1.1.1.2 mrg yyarg[yycount++] = yytname[yytoken];
1314 1.1.1.2 mrg if (!yypact_value_is_default (yyn))
1315 1.1.1.2 mrg {
1316 1.1.1.2 mrg /* Start YYX at -YYN if negative to avoid negative indexes in
1317 1.1.1.2 mrg YYCHECK. In other words, skip the first -YYN actions for
1318 1.1.1.2 mrg this state because they are default actions. */
1319 1.1.1.2 mrg int yyxbegin = yyn < 0 ? -yyn : 0;
1320 1.1.1.2 mrg /* Stay within bounds of both yycheck and yytname. */
1321 1.1.1.2 mrg int yychecklim = YYLAST - yyn + 1;
1322 1.1.1.2 mrg int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1323 1.1.1.2 mrg int yyx;
1324 1.1.1.2 mrg
1325 1.1.1.2 mrg for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1326 1.1.1.2 mrg if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1327 1.1.1.2 mrg && !yytable_value_is_error (yytable[yyx + yyn]))
1328 1.1.1.2 mrg {
1329 1.1.1.2 mrg if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1330 1.1.1.2 mrg {
1331 1.1.1.2 mrg yycount = 1;
1332 1.1.1.2 mrg yysize = yysize0;
1333 1.1.1.2 mrg break;
1334 1.1.1.2 mrg }
1335 1.1.1.2 mrg yyarg[yycount++] = yytname[yyx];
1336 1.1.1.2 mrg {
1337 1.1.1.2 mrg YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1338 1.1.1.2 mrg if (! (yysize <= yysize1
1339 1.1.1.2 mrg && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1340 1.1.1.2 mrg return 2;
1341 1.1.1.2 mrg yysize = yysize1;
1342 1.1.1.2 mrg }
1343 1.1.1.2 mrg }
1344 1.1.1.2 mrg }
1345 1.1.1.2 mrg }
1346 1.1 mrg
1347 1.1.1.2 mrg switch (yycount)
1348 1.1 mrg {
1349 1.1.1.2 mrg # define YYCASE_(N, S) \
1350 1.1.1.2 mrg case N: \
1351 1.1.1.2 mrg yyformat = S; \
1352 1.1.1.2 mrg break
1353 1.1.1.2 mrg YYCASE_(0, YY_("syntax error"));
1354 1.1.1.2 mrg YYCASE_(1, YY_("syntax error, unexpected %s"));
1355 1.1.1.2 mrg YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1356 1.1.1.2 mrg YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1357 1.1.1.2 mrg YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1358 1.1.1.2 mrg YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1359 1.1.1.2 mrg # undef YYCASE_
1360 1.1.1.2 mrg }
1361 1.1.1.2 mrg
1362 1.1.1.2 mrg {
1363 1.1.1.2 mrg YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1364 1.1.1.2 mrg if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1365 1.1.1.2 mrg return 2;
1366 1.1.1.2 mrg yysize = yysize1;
1367 1.1.1.2 mrg }
1368 1.1.1.2 mrg
1369 1.1.1.2 mrg if (*yymsg_alloc < yysize)
1370 1.1.1.2 mrg {
1371 1.1.1.2 mrg *yymsg_alloc = 2 * yysize;
1372 1.1.1.2 mrg if (! (yysize <= *yymsg_alloc
1373 1.1.1.2 mrg && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1374 1.1.1.2 mrg *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1375 1.1.1.2 mrg return 1;
1376 1.1.1.2 mrg }
1377 1.1.1.2 mrg
1378 1.1.1.2 mrg /* Avoid sprintf, as that infringes on the user's name space.
1379 1.1.1.2 mrg Don't have undefined behavior even if the translation
1380 1.1.1.2 mrg produced a string with the wrong number of "%s"s. */
1381 1.1.1.2 mrg {
1382 1.1.1.2 mrg char *yyp = *yymsg;
1383 1.1.1.2 mrg int yyi = 0;
1384 1.1.1.2 mrg while ((*yyp = *yyformat) != '\0')
1385 1.1.1.2 mrg if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1386 1.1.1.2 mrg {
1387 1.1.1.2 mrg yyp += yytnamerr (yyp, yyarg[yyi++]);
1388 1.1.1.2 mrg yyformat += 2;
1389 1.1.1.2 mrg }
1390 1.1.1.2 mrg else
1391 1.1.1.2 mrg {
1392 1.1.1.2 mrg yyp++;
1393 1.1.1.2 mrg yyformat++;
1394 1.1.1.2 mrg }
1395 1.1.1.2 mrg }
1396 1.1.1.2 mrg return 0;
1397 1.1 mrg }
1398 1.1 mrg #endif /* YYERROR_VERBOSE */
1399 1.1 mrg
1400 1.1 mrg /*-----------------------------------------------.
1401 1.1 mrg | Release the memory associated to this symbol. |
1402 1.1 mrg `-----------------------------------------------*/
1403 1.1 mrg
1404 1.1 mrg /*ARGSUSED*/
1405 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
1406 1.1 mrg || defined __cplusplus || defined _MSC_VER)
1407 1.1 mrg static void
1408 1.1 mrg yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1409 1.1 mrg #else
1410 1.1 mrg static void
1411 1.1 mrg yydestruct (yymsg, yytype, yyvaluep)
1412 1.1 mrg const char *yymsg;
1413 1.1 mrg int yytype;
1414 1.1 mrg YYSTYPE *yyvaluep;
1415 1.1 mrg #endif
1416 1.1 mrg {
1417 1.1 mrg YYUSE (yyvaluep);
1418 1.1 mrg
1419 1.1 mrg if (!yymsg)
1420 1.1 mrg yymsg = "Deleting";
1421 1.1 mrg YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1422 1.1 mrg
1423 1.1.1.2 mrg YYUSE (yytype);
1424 1.1 mrg }
1425 1.1 mrg
1426 1.1.1.2 mrg
1427 1.1 mrg
1428 1.1 mrg
1429 1.1 mrg /* The lookahead symbol. */
1430 1.1 mrg int yychar;
1431 1.1 mrg
1432 1.1.1.2 mrg
1433 1.1.1.2 mrg #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1434 1.1.1.2 mrg # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1435 1.1.1.2 mrg # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1436 1.1.1.2 mrg #endif
1437 1.1.1.2 mrg #ifndef YY_INITIAL_VALUE
1438 1.1.1.2 mrg # define YY_INITIAL_VALUE(Value) /* Nothing. */
1439 1.1.1.2 mrg #endif
1440 1.1.1.2 mrg
1441 1.1 mrg /* The semantic value of the lookahead symbol. */
1442 1.1.1.2 mrg YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
1443 1.1 mrg
1444 1.1 mrg /* Number of syntax errors so far. */
1445 1.1 mrg int yynerrs;
1446 1.1 mrg
1447 1.1 mrg
1448 1.1.1.2 mrg /*----------.
1449 1.1.1.2 mrg | yyparse. |
1450 1.1.1.2 mrg `----------*/
1451 1.1 mrg
1452 1.1 mrg #ifdef YYPARSE_PARAM
1453 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
1454 1.1 mrg || defined __cplusplus || defined _MSC_VER)
1455 1.1 mrg int
1456 1.1 mrg yyparse (void *YYPARSE_PARAM)
1457 1.1 mrg #else
1458 1.1 mrg int
1459 1.1 mrg yyparse (YYPARSE_PARAM)
1460 1.1 mrg void *YYPARSE_PARAM;
1461 1.1 mrg #endif
1462 1.1 mrg #else /* ! YYPARSE_PARAM */
1463 1.1 mrg #if (defined __STDC__ || defined __C99__FUNC__ \
1464 1.1 mrg || defined __cplusplus || defined _MSC_VER)
1465 1.1 mrg int
1466 1.1 mrg yyparse (void)
1467 1.1 mrg #else
1468 1.1 mrg int
1469 1.1 mrg yyparse ()
1470 1.1 mrg
1471 1.1 mrg #endif
1472 1.1 mrg #endif
1473 1.1 mrg {
1474 1.1 mrg int yystate;
1475 1.1 mrg /* Number of tokens to shift before error messages enabled. */
1476 1.1 mrg int yyerrstatus;
1477 1.1 mrg
1478 1.1 mrg /* The stacks and their tools:
1479 1.1 mrg `yyss': related to states.
1480 1.1 mrg `yyvs': related to semantic values.
1481 1.1 mrg
1482 1.1.1.2 mrg Refer to the stacks through separate pointers, to allow yyoverflow
1483 1.1 mrg to reallocate them elsewhere. */
1484 1.1 mrg
1485 1.1 mrg /* The state stack. */
1486 1.1 mrg yytype_int16 yyssa[YYINITDEPTH];
1487 1.1 mrg yytype_int16 *yyss;
1488 1.1 mrg yytype_int16 *yyssp;
1489 1.1 mrg
1490 1.1 mrg /* The semantic value stack. */
1491 1.1 mrg YYSTYPE yyvsa[YYINITDEPTH];
1492 1.1 mrg YYSTYPE *yyvs;
1493 1.1 mrg YYSTYPE *yyvsp;
1494 1.1 mrg
1495 1.1 mrg YYSIZE_T yystacksize;
1496 1.1 mrg
1497 1.1 mrg int yyn;
1498 1.1 mrg int yyresult;
1499 1.1 mrg /* Lookahead token as an internal (translated) token number. */
1500 1.1.1.2 mrg int yytoken = 0;
1501 1.1 mrg /* The variables used to return semantic value and location from the
1502 1.1 mrg action routines. */
1503 1.1 mrg YYSTYPE yyval;
1504 1.1 mrg
1505 1.1 mrg #if YYERROR_VERBOSE
1506 1.1 mrg /* Buffer for error messages, and its allocated size. */
1507 1.1 mrg char yymsgbuf[128];
1508 1.1 mrg char *yymsg = yymsgbuf;
1509 1.1 mrg YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1510 1.1 mrg #endif
1511 1.1 mrg
1512 1.1 mrg #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1513 1.1 mrg
1514 1.1 mrg /* The number of symbols on the RHS of the reduced rule.
1515 1.1 mrg Keep to zero when no symbol should be popped. */
1516 1.1 mrg int yylen = 0;
1517 1.1 mrg
1518 1.1.1.2 mrg yyssp = yyss = yyssa;
1519 1.1.1.2 mrg yyvsp = yyvs = yyvsa;
1520 1.1 mrg yystacksize = YYINITDEPTH;
1521 1.1 mrg
1522 1.1 mrg YYDPRINTF ((stderr, "Starting parse\n"));
1523 1.1 mrg
1524 1.1 mrg yystate = 0;
1525 1.1 mrg yyerrstatus = 0;
1526 1.1 mrg yynerrs = 0;
1527 1.1 mrg yychar = YYEMPTY; /* Cause a token to be read. */
1528 1.1 mrg goto yysetstate;
1529 1.1 mrg
1530 1.1 mrg /*------------------------------------------------------------.
1531 1.1 mrg | yynewstate -- Push a new state, which is found in yystate. |
1532 1.1 mrg `------------------------------------------------------------*/
1533 1.1 mrg yynewstate:
1534 1.1 mrg /* In all cases, when you get here, the value and location stacks
1535 1.1 mrg have just been pushed. So pushing a state here evens the stacks. */
1536 1.1 mrg yyssp++;
1537 1.1 mrg
1538 1.1 mrg yysetstate:
1539 1.1 mrg *yyssp = yystate;
1540 1.1 mrg
1541 1.1 mrg if (yyss + yystacksize - 1 <= yyssp)
1542 1.1 mrg {
1543 1.1 mrg /* Get the current used size of the three stacks, in elements. */
1544 1.1 mrg YYSIZE_T yysize = yyssp - yyss + 1;
1545 1.1 mrg
1546 1.1 mrg #ifdef yyoverflow
1547 1.1 mrg {
1548 1.1 mrg /* Give user a chance to reallocate the stack. Use copies of
1549 1.1 mrg these so that the &'s don't force the real ones into
1550 1.1 mrg memory. */
1551 1.1 mrg YYSTYPE *yyvs1 = yyvs;
1552 1.1 mrg yytype_int16 *yyss1 = yyss;
1553 1.1 mrg
1554 1.1 mrg /* Each stack pointer address is followed by the size of the
1555 1.1 mrg data in use in that stack, in bytes. This used to be a
1556 1.1 mrg conditional around just the two extra args, but that might
1557 1.1 mrg be undefined if yyoverflow is a macro. */
1558 1.1 mrg yyoverflow (YY_("memory exhausted"),
1559 1.1 mrg &yyss1, yysize * sizeof (*yyssp),
1560 1.1 mrg &yyvs1, yysize * sizeof (*yyvsp),
1561 1.1 mrg &yystacksize);
1562 1.1 mrg
1563 1.1 mrg yyss = yyss1;
1564 1.1 mrg yyvs = yyvs1;
1565 1.1 mrg }
1566 1.1 mrg #else /* no yyoverflow */
1567 1.1 mrg # ifndef YYSTACK_RELOCATE
1568 1.1 mrg goto yyexhaustedlab;
1569 1.1 mrg # else
1570 1.1 mrg /* Extend the stack our own way. */
1571 1.1 mrg if (YYMAXDEPTH <= yystacksize)
1572 1.1 mrg goto yyexhaustedlab;
1573 1.1 mrg yystacksize *= 2;
1574 1.1 mrg if (YYMAXDEPTH < yystacksize)
1575 1.1 mrg yystacksize = YYMAXDEPTH;
1576 1.1 mrg
1577 1.1 mrg {
1578 1.1 mrg yytype_int16 *yyss1 = yyss;
1579 1.1 mrg union yyalloc *yyptr =
1580 1.1 mrg (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1581 1.1 mrg if (! yyptr)
1582 1.1 mrg goto yyexhaustedlab;
1583 1.1 mrg YYSTACK_RELOCATE (yyss_alloc, yyss);
1584 1.1 mrg YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1585 1.1 mrg # undef YYSTACK_RELOCATE
1586 1.1 mrg if (yyss1 != yyssa)
1587 1.1 mrg YYSTACK_FREE (yyss1);
1588 1.1 mrg }
1589 1.1 mrg # endif
1590 1.1 mrg #endif /* no yyoverflow */
1591 1.1 mrg
1592 1.1 mrg yyssp = yyss + yysize - 1;
1593 1.1 mrg yyvsp = yyvs + yysize - 1;
1594 1.1 mrg
1595 1.1 mrg YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1596 1.1 mrg (unsigned long int) yystacksize));
1597 1.1 mrg
1598 1.1 mrg if (yyss + yystacksize - 1 <= yyssp)
1599 1.1 mrg YYABORT;
1600 1.1 mrg }
1601 1.1 mrg
1602 1.1 mrg YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1603 1.1 mrg
1604 1.1 mrg if (yystate == YYFINAL)
1605 1.1 mrg YYACCEPT;
1606 1.1 mrg
1607 1.1 mrg goto yybackup;
1608 1.1 mrg
1609 1.1 mrg /*-----------.
1610 1.1 mrg | yybackup. |
1611 1.1 mrg `-----------*/
1612 1.1 mrg yybackup:
1613 1.1 mrg
1614 1.1 mrg /* Do appropriate processing given the current state. Read a
1615 1.1 mrg lookahead token if we need one and don't already have one. */
1616 1.1 mrg
1617 1.1 mrg /* First try to decide what to do without reference to lookahead token. */
1618 1.1 mrg yyn = yypact[yystate];
1619 1.1.1.2 mrg if (yypact_value_is_default (yyn))
1620 1.1 mrg goto yydefault;
1621 1.1 mrg
1622 1.1 mrg /* Not known => get a lookahead token if don't already have one. */
1623 1.1 mrg
1624 1.1 mrg /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1625 1.1 mrg if (yychar == YYEMPTY)
1626 1.1 mrg {
1627 1.1 mrg YYDPRINTF ((stderr, "Reading a token: "));
1628 1.1 mrg yychar = YYLEX;
1629 1.1 mrg }
1630 1.1 mrg
1631 1.1 mrg if (yychar <= YYEOF)
1632 1.1 mrg {
1633 1.1 mrg yychar = yytoken = YYEOF;
1634 1.1 mrg YYDPRINTF ((stderr, "Now at end of input.\n"));
1635 1.1 mrg }
1636 1.1 mrg else
1637 1.1 mrg {
1638 1.1 mrg yytoken = YYTRANSLATE (yychar);
1639 1.1 mrg YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1640 1.1 mrg }
1641 1.1 mrg
1642 1.1 mrg /* If the proper action on seeing token YYTOKEN is to reduce or to
1643 1.1 mrg detect an error, take that action. */
1644 1.1 mrg yyn += yytoken;
1645 1.1 mrg if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1646 1.1 mrg goto yydefault;
1647 1.1 mrg yyn = yytable[yyn];
1648 1.1 mrg if (yyn <= 0)
1649 1.1 mrg {
1650 1.1.1.2 mrg if (yytable_value_is_error (yyn))
1651 1.1.1.2 mrg goto yyerrlab;
1652 1.1 mrg yyn = -yyn;
1653 1.1 mrg goto yyreduce;
1654 1.1 mrg }
1655 1.1 mrg
1656 1.1 mrg /* Count tokens shifted since error; after three, turn off error
1657 1.1 mrg status. */
1658 1.1 mrg if (yyerrstatus)
1659 1.1 mrg yyerrstatus--;
1660 1.1 mrg
1661 1.1 mrg /* Shift the lookahead token. */
1662 1.1 mrg YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1663 1.1 mrg
1664 1.1 mrg /* Discard the shifted token. */
1665 1.1 mrg yychar = YYEMPTY;
1666 1.1 mrg
1667 1.1 mrg yystate = yyn;
1668 1.1.1.2 mrg YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1669 1.1 mrg *++yyvsp = yylval;
1670 1.1.1.2 mrg YY_IGNORE_MAYBE_UNINITIALIZED_END
1671 1.1 mrg
1672 1.1 mrg goto yynewstate;
1673 1.1 mrg
1674 1.1 mrg
1675 1.1 mrg /*-----------------------------------------------------------.
1676 1.1 mrg | yydefault -- do the default action for the current state. |
1677 1.1 mrg `-----------------------------------------------------------*/
1678 1.1 mrg yydefault:
1679 1.1 mrg yyn = yydefact[yystate];
1680 1.1 mrg if (yyn == 0)
1681 1.1 mrg goto yyerrlab;
1682 1.1 mrg goto yyreduce;
1683 1.1 mrg
1684 1.1 mrg
1685 1.1 mrg /*-----------------------------.
1686 1.1 mrg | yyreduce -- Do a reduction. |
1687 1.1 mrg `-----------------------------*/
1688 1.1 mrg yyreduce:
1689 1.1 mrg /* yyn is the number of a rule to reduce with. */
1690 1.1 mrg yylen = yyr2[yyn];
1691 1.1 mrg
1692 1.1 mrg /* If YYLEN is nonzero, implement the default value of the action:
1693 1.1 mrg `$$ = $1'.
1694 1.1 mrg
1695 1.1 mrg Otherwise, the following line sets YYVAL to garbage.
1696 1.1 mrg This behavior is undocumented and Bison
1697 1.1 mrg users should not rely upon it. Assigning to YYVAL
1698 1.1 mrg unconditionally makes the parser a bit smaller, and it avoids a
1699 1.1 mrg GCC warning that YYVAL may be used uninitialized. */
1700 1.1 mrg yyval = yyvsp[1-yylen];
1701 1.1 mrg
1702 1.1 mrg
1703 1.1 mrg YY_REDUCE_PRINT (yyn);
1704 1.1 mrg switch (yyn)
1705 1.1 mrg {
1706 1.1 mrg case 6:
1707 1.1.1.2 mrg /* Line 1787 of yacc.c */
1708 1.1.1.3 mrg #line 173 "../../../gmp/demos/calc/calc.y"
1709 1.1 mrg { sp = stack[0]; yyerrok; }
1710 1.1 mrg break;
1711 1.1 mrg
1712 1.1 mrg case 8:
1713 1.1.1.2 mrg /* Line 1787 of yacc.c */
1714 1.1.1.3 mrg #line 177 "../../../gmp/demos/calc/calc.y"
1715 1.1 mrg {
1716 1.1 mrg mpz_out_str (stdout, obase, sp); putchar ('\n');
1717 1.1 mrg sp--;
1718 1.1 mrg CHECK_EMPTY ();
1719 1.1 mrg }
1720 1.1 mrg break;
1721 1.1 mrg
1722 1.1 mrg case 9:
1723 1.1.1.2 mrg /* Line 1787 of yacc.c */
1724 1.1.1.3 mrg #line 182 "../../../gmp/demos/calc/calc.y"
1725 1.1 mrg {
1726 1.1 mrg CHECK_VARIABLE ((yyvsp[(1) - (3)].var));
1727 1.1 mrg mpz_swap (variable[(yyvsp[(1) - (3)].var)], sp);
1728 1.1 mrg sp--;
1729 1.1 mrg CHECK_EMPTY ();
1730 1.1 mrg }
1731 1.1 mrg break;
1732 1.1 mrg
1733 1.1 mrg case 10:
1734 1.1.1.2 mrg /* Line 1787 of yacc.c */
1735 1.1.1.3 mrg #line 188 "../../../gmp/demos/calc/calc.y"
1736 1.1 mrg { calc_help (); }
1737 1.1 mrg break;
1738 1.1 mrg
1739 1.1 mrg case 11:
1740 1.1.1.2 mrg /* Line 1787 of yacc.c */
1741 1.1.1.3 mrg #line 189 "../../../gmp/demos/calc/calc.y"
1742 1.1 mrg { ibase = 16; obase = -16; }
1743 1.1 mrg break;
1744 1.1 mrg
1745 1.1 mrg case 12:
1746 1.1.1.2 mrg /* Line 1787 of yacc.c */
1747 1.1.1.3 mrg #line 190 "../../../gmp/demos/calc/calc.y"
1748 1.1 mrg { ibase = 0; obase = 10; }
1749 1.1 mrg break;
1750 1.1 mrg
1751 1.1 mrg case 13:
1752 1.1.1.2 mrg /* Line 1787 of yacc.c */
1753 1.1.1.3 mrg #line 191 "../../../gmp/demos/calc/calc.y"
1754 1.1 mrg { exit (0); }
1755 1.1 mrg break;
1756 1.1 mrg
1757 1.1 mrg case 15:
1758 1.1.1.2 mrg /* Line 1787 of yacc.c */
1759 1.1.1.3 mrg #line 198 "../../../gmp/demos/calc/calc.y"
1760 1.1 mrg { sp--; mpz_add (sp, sp, sp+1); }
1761 1.1 mrg break;
1762 1.1 mrg
1763 1.1 mrg case 16:
1764 1.1.1.2 mrg /* Line 1787 of yacc.c */
1765 1.1.1.3 mrg #line 199 "../../../gmp/demos/calc/calc.y"
1766 1.1 mrg { sp--; mpz_sub (sp, sp, sp+1); }
1767 1.1 mrg break;
1768 1.1 mrg
1769 1.1 mrg case 17:
1770 1.1.1.2 mrg /* Line 1787 of yacc.c */
1771 1.1.1.3 mrg #line 200 "../../../gmp/demos/calc/calc.y"
1772 1.1 mrg { sp--; mpz_mul (sp, sp, sp+1); }
1773 1.1 mrg break;
1774 1.1 mrg
1775 1.1 mrg case 18:
1776 1.1.1.2 mrg /* Line 1787 of yacc.c */
1777 1.1.1.3 mrg #line 201 "../../../gmp/demos/calc/calc.y"
1778 1.1 mrg { sp--; mpz_fdiv_q (sp, sp, sp+1); }
1779 1.1 mrg break;
1780 1.1 mrg
1781 1.1 mrg case 19:
1782 1.1.1.2 mrg /* Line 1787 of yacc.c */
1783 1.1.1.3 mrg #line 202 "../../../gmp/demos/calc/calc.y"
1784 1.1 mrg { sp--; mpz_fdiv_r (sp, sp, sp+1); }
1785 1.1 mrg break;
1786 1.1 mrg
1787 1.1 mrg case 20:
1788 1.1.1.2 mrg /* Line 1787 of yacc.c */
1789 1.1.1.3 mrg #line 203 "../../../gmp/demos/calc/calc.y"
1790 1.1 mrg { CHECK_UI ("Exponent", sp);
1791 1.1 mrg sp--; mpz_pow_ui (sp, sp, mpz_get_ui (sp+1)); }
1792 1.1 mrg break;
1793 1.1 mrg
1794 1.1 mrg case 21:
1795 1.1.1.2 mrg /* Line 1787 of yacc.c */
1796 1.1.1.3 mrg #line 205 "../../../gmp/demos/calc/calc.y"
1797 1.1 mrg { CHECK_UI ("Shift count", sp);
1798 1.1 mrg sp--; mpz_mul_2exp (sp, sp, mpz_get_ui (sp+1)); }
1799 1.1 mrg break;
1800 1.1 mrg
1801 1.1 mrg case 22:
1802 1.1.1.2 mrg /* Line 1787 of yacc.c */
1803 1.1.1.3 mrg #line 207 "../../../gmp/demos/calc/calc.y"
1804 1.1 mrg { CHECK_UI ("Shift count", sp);
1805 1.1 mrg sp--; mpz_fdiv_q_2exp (sp, sp, mpz_get_ui (sp+1)); }
1806 1.1 mrg break;
1807 1.1 mrg
1808 1.1 mrg case 23:
1809 1.1.1.2 mrg /* Line 1787 of yacc.c */
1810 1.1.1.3 mrg #line 209 "../../../gmp/demos/calc/calc.y"
1811 1.1 mrg { CHECK_UI ("Factorial", sp);
1812 1.1 mrg mpz_fac_ui (sp, mpz_get_ui (sp)); }
1813 1.1 mrg break;
1814 1.1 mrg
1815 1.1 mrg case 24:
1816 1.1.1.2 mrg /* Line 1787 of yacc.c */
1817 1.1.1.3 mrg #line 211 "../../../gmp/demos/calc/calc.y"
1818 1.1 mrg { mpz_neg (sp, sp); }
1819 1.1 mrg break;
1820 1.1 mrg
1821 1.1 mrg case 25:
1822 1.1.1.2 mrg /* Line 1787 of yacc.c */
1823 1.1.1.3 mrg #line 213 "../../../gmp/demos/calc/calc.y"
1824 1.1 mrg { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) < 0); }
1825 1.1 mrg break;
1826 1.1 mrg
1827 1.1 mrg case 26:
1828 1.1.1.2 mrg /* Line 1787 of yacc.c */
1829 1.1.1.3 mrg #line 214 "../../../gmp/demos/calc/calc.y"
1830 1.1 mrg { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <= 0); }
1831 1.1 mrg break;
1832 1.1 mrg
1833 1.1 mrg case 27:
1834 1.1.1.2 mrg /* Line 1787 of yacc.c */
1835 1.1.1.3 mrg #line 215 "../../../gmp/demos/calc/calc.y"
1836 1.1 mrg { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) == 0); }
1837 1.1 mrg break;
1838 1.1 mrg
1839 1.1 mrg case 28:
1840 1.1.1.2 mrg /* Line 1787 of yacc.c */
1841 1.1.1.3 mrg #line 216 "../../../gmp/demos/calc/calc.y"
1842 1.1 mrg { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) != 0); }
1843 1.1 mrg break;
1844 1.1 mrg
1845 1.1 mrg case 29:
1846 1.1.1.2 mrg /* Line 1787 of yacc.c */
1847 1.1.1.3 mrg #line 217 "../../../gmp/demos/calc/calc.y"
1848 1.1 mrg { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >= 0); }
1849 1.1 mrg break;
1850 1.1 mrg
1851 1.1 mrg case 30:
1852 1.1.1.2 mrg /* Line 1787 of yacc.c */
1853 1.1.1.3 mrg #line 218 "../../../gmp/demos/calc/calc.y"
1854 1.1 mrg { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) > 0); }
1855 1.1 mrg break;
1856 1.1 mrg
1857 1.1 mrg case 31:
1858 1.1.1.2 mrg /* Line 1787 of yacc.c */
1859 1.1.1.3 mrg #line 220 "../../../gmp/demos/calc/calc.y"
1860 1.1 mrg { sp--; mpz_set_ui (sp, mpz_sgn (sp) && mpz_sgn (sp+1)); }
1861 1.1 mrg break;
1862 1.1 mrg
1863 1.1 mrg case 32:
1864 1.1.1.2 mrg /* Line 1787 of yacc.c */
1865 1.1.1.3 mrg #line 221 "../../../gmp/demos/calc/calc.y"
1866 1.1 mrg { sp--; mpz_set_ui (sp, mpz_sgn (sp) || mpz_sgn (sp+1)); }
1867 1.1 mrg break;
1868 1.1 mrg
1869 1.1 mrg case 33:
1870 1.1.1.2 mrg /* Line 1787 of yacc.c */
1871 1.1.1.3 mrg #line 223 "../../../gmp/demos/calc/calc.y"
1872 1.1 mrg { mpz_abs (sp, sp); }
1873 1.1 mrg break;
1874 1.1 mrg
1875 1.1 mrg case 34:
1876 1.1.1.2 mrg /* Line 1787 of yacc.c */
1877 1.1.1.3 mrg #line 224 "../../../gmp/demos/calc/calc.y"
1878 1.1 mrg { sp--; CHECK_UI ("Binomial base", sp+1);
1879 1.1 mrg mpz_bin_ui (sp, sp, mpz_get_ui (sp+1)); }
1880 1.1 mrg break;
1881 1.1 mrg
1882 1.1 mrg case 35:
1883 1.1.1.2 mrg /* Line 1787 of yacc.c */
1884 1.1.1.3 mrg #line 226 "../../../gmp/demos/calc/calc.y"
1885 1.1 mrg { CHECK_UI ("Fibonacci", sp);
1886 1.1 mrg mpz_fib_ui (sp, mpz_get_ui (sp)); }
1887 1.1 mrg break;
1888 1.1 mrg
1889 1.1 mrg case 37:
1890 1.1.1.2 mrg /* Line 1787 of yacc.c */
1891 1.1.1.3 mrg #line 229 "../../../gmp/demos/calc/calc.y"
1892 1.1 mrg { sp--; mpz_set_si (sp,
1893 1.1 mrg mpz_kronecker (sp, sp+1)); }
1894 1.1 mrg break;
1895 1.1 mrg
1896 1.1 mrg case 39:
1897 1.1.1.2 mrg /* Line 1787 of yacc.c */
1898 1.1.1.3 mrg #line 232 "../../../gmp/demos/calc/calc.y"
1899 1.1 mrg { CHECK_UI ("Lucas number", sp);
1900 1.1 mrg mpz_lucnum_ui (sp, mpz_get_ui (sp)); }
1901 1.1 mrg break;
1902 1.1 mrg
1903 1.1 mrg case 40:
1904 1.1.1.2 mrg /* Line 1787 of yacc.c */
1905 1.1.1.3 mrg #line 234 "../../../gmp/demos/calc/calc.y"
1906 1.1 mrg { mpz_nextprime (sp, sp); }
1907 1.1 mrg break;
1908 1.1 mrg
1909 1.1 mrg case 41:
1910 1.1.1.2 mrg /* Line 1787 of yacc.c */
1911 1.1.1.3 mrg #line 235 "../../../gmp/demos/calc/calc.y"
1912 1.1 mrg { sp -= 2; mpz_powm (sp, sp, sp+1, sp+2); }
1913 1.1 mrg break;
1914 1.1 mrg
1915 1.1 mrg case 42:
1916 1.1.1.2 mrg /* Line 1787 of yacc.c */
1917 1.1.1.3 mrg #line 236 "../../../gmp/demos/calc/calc.y"
1918 1.1 mrg { sp--; CHECK_UI ("Nth-root", sp+1);
1919 1.1 mrg mpz_root (sp, sp, mpz_get_ui (sp+1)); }
1920 1.1 mrg break;
1921 1.1 mrg
1922 1.1 mrg case 43:
1923 1.1.1.2 mrg /* Line 1787 of yacc.c */
1924 1.1.1.3 mrg #line 238 "../../../gmp/demos/calc/calc.y"
1925 1.1 mrg { mpz_sqrt (sp, sp); }
1926 1.1 mrg break;
1927 1.1 mrg
1928 1.1 mrg case 44:
1929 1.1.1.2 mrg /* Line 1787 of yacc.c */
1930 1.1.1.3 mrg #line 240 "../../../gmp/demos/calc/calc.y"
1931 1.1 mrg {
1932 1.1 mrg sp++;
1933 1.1 mrg CHECK_OVERFLOW ();
1934 1.1 mrg CHECK_VARIABLE ((yyvsp[(1) - (1)].var));
1935 1.1 mrg mpz_set (sp, variable[(yyvsp[(1) - (1)].var)]);
1936 1.1 mrg }
1937 1.1 mrg break;
1938 1.1 mrg
1939 1.1 mrg case 45:
1940 1.1.1.2 mrg /* Line 1787 of yacc.c */
1941 1.1.1.3 mrg #line 246 "../../../gmp/demos/calc/calc.y"
1942 1.1 mrg {
1943 1.1 mrg sp++;
1944 1.1 mrg CHECK_OVERFLOW ();
1945 1.1 mrg if (mpz_set_str (sp, (yyvsp[(1) - (1)].str), ibase) != 0)
1946 1.1 mrg {
1947 1.1 mrg fprintf (stderr, "Invalid number: %s\n", (yyvsp[(1) - (1)].str));
1948 1.1 mrg YYERROR;
1949 1.1 mrg }
1950 1.1 mrg }
1951 1.1 mrg break;
1952 1.1 mrg
1953 1.1 mrg case 47:
1954 1.1.1.2 mrg /* Line 1787 of yacc.c */
1955 1.1.1.3 mrg #line 258 "../../../gmp/demos/calc/calc.y"
1956 1.1 mrg { sp--; mpz_gcd (sp, sp, sp+1); }
1957 1.1 mrg break;
1958 1.1 mrg
1959 1.1 mrg case 49:
1960 1.1.1.2 mrg /* Line 1787 of yacc.c */
1961 1.1.1.3 mrg #line 262 "../../../gmp/demos/calc/calc.y"
1962 1.1 mrg { sp--; mpz_lcm (sp, sp, sp+1); }
1963 1.1 mrg break;
1964 1.1 mrg
1965 1.1 mrg
1966 1.1.1.2 mrg /* Line 1787 of yacc.c */
1967 1.1.1.2 mrg #line 1968 "calc.c"
1968 1.1 mrg default: break;
1969 1.1 mrg }
1970 1.1.1.2 mrg /* User semantic actions sometimes alter yychar, and that requires
1971 1.1.1.2 mrg that yytoken be updated with the new translation. We take the
1972 1.1.1.2 mrg approach of translating immediately before every use of yytoken.
1973 1.1.1.2 mrg One alternative is translating here after every semantic action,
1974 1.1.1.2 mrg but that translation would be missed if the semantic action invokes
1975 1.1.1.2 mrg YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1976 1.1.1.2 mrg if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1977 1.1.1.2 mrg incorrect destructor might then be invoked immediately. In the
1978 1.1.1.2 mrg case of YYERROR or YYBACKUP, subsequent parser actions might lead
1979 1.1.1.2 mrg to an incorrect destructor call or verbose syntax error message
1980 1.1.1.2 mrg before the lookahead is translated. */
1981 1.1 mrg YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1982 1.1 mrg
1983 1.1 mrg YYPOPSTACK (yylen);
1984 1.1 mrg yylen = 0;
1985 1.1 mrg YY_STACK_PRINT (yyss, yyssp);
1986 1.1 mrg
1987 1.1 mrg *++yyvsp = yyval;
1988 1.1 mrg
1989 1.1 mrg /* Now `shift' the result of the reduction. Determine what state
1990 1.1 mrg that goes to, based on the state we popped back to and the rule
1991 1.1 mrg number reduced by. */
1992 1.1 mrg
1993 1.1 mrg yyn = yyr1[yyn];
1994 1.1 mrg
1995 1.1 mrg yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1996 1.1 mrg if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1997 1.1 mrg yystate = yytable[yystate];
1998 1.1 mrg else
1999 1.1 mrg yystate = yydefgoto[yyn - YYNTOKENS];
2000 1.1 mrg
2001 1.1 mrg goto yynewstate;
2002 1.1 mrg
2003 1.1 mrg
2004 1.1 mrg /*------------------------------------.
2005 1.1 mrg | yyerrlab -- here on detecting error |
2006 1.1 mrg `------------------------------------*/
2007 1.1 mrg yyerrlab:
2008 1.1.1.2 mrg /* Make sure we have latest lookahead translation. See comments at
2009 1.1.1.2 mrg user semantic actions for why this is necessary. */
2010 1.1.1.2 mrg yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2011 1.1.1.2 mrg
2012 1.1 mrg /* If not already recovering from an error, report this error. */
2013 1.1 mrg if (!yyerrstatus)
2014 1.1 mrg {
2015 1.1 mrg ++yynerrs;
2016 1.1 mrg #if ! YYERROR_VERBOSE
2017 1.1 mrg yyerror (YY_("syntax error"));
2018 1.1 mrg #else
2019 1.1.1.2 mrg # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2020 1.1.1.2 mrg yyssp, yytoken)
2021 1.1 mrg {
2022 1.1.1.2 mrg char const *yymsgp = YY_("syntax error");
2023 1.1.1.2 mrg int yysyntax_error_status;
2024 1.1.1.2 mrg yysyntax_error_status = YYSYNTAX_ERROR;
2025 1.1.1.2 mrg if (yysyntax_error_status == 0)
2026 1.1.1.2 mrg yymsgp = yymsg;
2027 1.1.1.2 mrg else if (yysyntax_error_status == 1)
2028 1.1.1.2 mrg {
2029 1.1.1.2 mrg if (yymsg != yymsgbuf)
2030 1.1.1.2 mrg YYSTACK_FREE (yymsg);
2031 1.1.1.2 mrg yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2032 1.1.1.2 mrg if (!yymsg)
2033 1.1.1.2 mrg {
2034 1.1.1.2 mrg yymsg = yymsgbuf;
2035 1.1.1.2 mrg yymsg_alloc = sizeof yymsgbuf;
2036 1.1.1.2 mrg yysyntax_error_status = 2;
2037 1.1.1.2 mrg }
2038 1.1.1.2 mrg else
2039 1.1.1.2 mrg {
2040 1.1.1.2 mrg yysyntax_error_status = YYSYNTAX_ERROR;
2041 1.1.1.2 mrg yymsgp = yymsg;
2042 1.1.1.2 mrg }
2043 1.1.1.2 mrg }
2044 1.1.1.2 mrg yyerror (yymsgp);
2045 1.1.1.2 mrg if (yysyntax_error_status == 2)
2046 1.1.1.2 mrg goto yyexhaustedlab;
2047 1.1 mrg }
2048 1.1.1.2 mrg # undef YYSYNTAX_ERROR
2049 1.1 mrg #endif
2050 1.1 mrg }
2051 1.1 mrg
2052 1.1 mrg
2053 1.1 mrg
2054 1.1 mrg if (yyerrstatus == 3)
2055 1.1 mrg {
2056 1.1 mrg /* If just tried and failed to reuse lookahead token after an
2057 1.1 mrg error, discard it. */
2058 1.1 mrg
2059 1.1 mrg if (yychar <= YYEOF)
2060 1.1 mrg {
2061 1.1 mrg /* Return failure if at end of input. */
2062 1.1 mrg if (yychar == YYEOF)
2063 1.1 mrg YYABORT;
2064 1.1 mrg }
2065 1.1 mrg else
2066 1.1 mrg {
2067 1.1 mrg yydestruct ("Error: discarding",
2068 1.1 mrg yytoken, &yylval);
2069 1.1 mrg yychar = YYEMPTY;
2070 1.1 mrg }
2071 1.1 mrg }
2072 1.1 mrg
2073 1.1 mrg /* Else will try to reuse lookahead token after shifting the error
2074 1.1 mrg token. */
2075 1.1 mrg goto yyerrlab1;
2076 1.1 mrg
2077 1.1 mrg
2078 1.1 mrg /*---------------------------------------------------.
2079 1.1 mrg | yyerrorlab -- error raised explicitly by YYERROR. |
2080 1.1 mrg `---------------------------------------------------*/
2081 1.1 mrg yyerrorlab:
2082 1.1 mrg
2083 1.1 mrg /* Pacify compilers like GCC when the user code never invokes
2084 1.1 mrg YYERROR and the label yyerrorlab therefore never appears in user
2085 1.1 mrg code. */
2086 1.1 mrg if (/*CONSTCOND*/ 0)
2087 1.1 mrg goto yyerrorlab;
2088 1.1 mrg
2089 1.1 mrg /* Do not reclaim the symbols of the rule which action triggered
2090 1.1 mrg this YYERROR. */
2091 1.1 mrg YYPOPSTACK (yylen);
2092 1.1 mrg yylen = 0;
2093 1.1 mrg YY_STACK_PRINT (yyss, yyssp);
2094 1.1 mrg yystate = *yyssp;
2095 1.1 mrg goto yyerrlab1;
2096 1.1 mrg
2097 1.1 mrg
2098 1.1 mrg /*-------------------------------------------------------------.
2099 1.1 mrg | yyerrlab1 -- common code for both syntax error and YYERROR. |
2100 1.1 mrg `-------------------------------------------------------------*/
2101 1.1 mrg yyerrlab1:
2102 1.1 mrg yyerrstatus = 3; /* Each real token shifted decrements this. */
2103 1.1 mrg
2104 1.1 mrg for (;;)
2105 1.1 mrg {
2106 1.1 mrg yyn = yypact[yystate];
2107 1.1.1.2 mrg if (!yypact_value_is_default (yyn))
2108 1.1 mrg {
2109 1.1 mrg yyn += YYTERROR;
2110 1.1 mrg if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2111 1.1 mrg {
2112 1.1 mrg yyn = yytable[yyn];
2113 1.1 mrg if (0 < yyn)
2114 1.1 mrg break;
2115 1.1 mrg }
2116 1.1 mrg }
2117 1.1 mrg
2118 1.1 mrg /* Pop the current state because it cannot handle the error token. */
2119 1.1 mrg if (yyssp == yyss)
2120 1.1 mrg YYABORT;
2121 1.1 mrg
2122 1.1 mrg
2123 1.1 mrg yydestruct ("Error: popping",
2124 1.1 mrg yystos[yystate], yyvsp);
2125 1.1 mrg YYPOPSTACK (1);
2126 1.1 mrg yystate = *yyssp;
2127 1.1 mrg YY_STACK_PRINT (yyss, yyssp);
2128 1.1 mrg }
2129 1.1 mrg
2130 1.1.1.2 mrg YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2131 1.1 mrg *++yyvsp = yylval;
2132 1.1.1.2 mrg YY_IGNORE_MAYBE_UNINITIALIZED_END
2133 1.1 mrg
2134 1.1 mrg
2135 1.1 mrg /* Shift the error token. */
2136 1.1 mrg YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2137 1.1 mrg
2138 1.1 mrg yystate = yyn;
2139 1.1 mrg goto yynewstate;
2140 1.1 mrg
2141 1.1 mrg
2142 1.1 mrg /*-------------------------------------.
2143 1.1 mrg | yyacceptlab -- YYACCEPT comes here. |
2144 1.1 mrg `-------------------------------------*/
2145 1.1 mrg yyacceptlab:
2146 1.1 mrg yyresult = 0;
2147 1.1 mrg goto yyreturn;
2148 1.1 mrg
2149 1.1 mrg /*-----------------------------------.
2150 1.1 mrg | yyabortlab -- YYABORT comes here. |
2151 1.1 mrg `-----------------------------------*/
2152 1.1 mrg yyabortlab:
2153 1.1 mrg yyresult = 1;
2154 1.1 mrg goto yyreturn;
2155 1.1 mrg
2156 1.1.1.2 mrg #if !defined yyoverflow || YYERROR_VERBOSE
2157 1.1 mrg /*-------------------------------------------------.
2158 1.1 mrg | yyexhaustedlab -- memory exhaustion comes here. |
2159 1.1 mrg `-------------------------------------------------*/
2160 1.1 mrg yyexhaustedlab:
2161 1.1 mrg yyerror (YY_("memory exhausted"));
2162 1.1 mrg yyresult = 2;
2163 1.1 mrg /* Fall through. */
2164 1.1 mrg #endif
2165 1.1 mrg
2166 1.1 mrg yyreturn:
2167 1.1 mrg if (yychar != YYEMPTY)
2168 1.1.1.2 mrg {
2169 1.1.1.2 mrg /* Make sure we have latest lookahead translation. See comments at
2170 1.1.1.2 mrg user semantic actions for why this is necessary. */
2171 1.1.1.2 mrg yytoken = YYTRANSLATE (yychar);
2172 1.1.1.2 mrg yydestruct ("Cleanup: discarding lookahead",
2173 1.1.1.2 mrg yytoken, &yylval);
2174 1.1.1.2 mrg }
2175 1.1 mrg /* Do not reclaim the symbols of the rule which action triggered
2176 1.1 mrg this YYABORT or YYACCEPT. */
2177 1.1 mrg YYPOPSTACK (yylen);
2178 1.1 mrg YY_STACK_PRINT (yyss, yyssp);
2179 1.1 mrg while (yyssp != yyss)
2180 1.1 mrg {
2181 1.1 mrg yydestruct ("Cleanup: popping",
2182 1.1 mrg yystos[*yyssp], yyvsp);
2183 1.1 mrg YYPOPSTACK (1);
2184 1.1 mrg }
2185 1.1 mrg #ifndef yyoverflow
2186 1.1 mrg if (yyss != yyssa)
2187 1.1 mrg YYSTACK_FREE (yyss);
2188 1.1 mrg #endif
2189 1.1 mrg #if YYERROR_VERBOSE
2190 1.1 mrg if (yymsg != yymsgbuf)
2191 1.1 mrg YYSTACK_FREE (yymsg);
2192 1.1 mrg #endif
2193 1.1 mrg /* Make sure YYID is used. */
2194 1.1 mrg return YYID (yyresult);
2195 1.1 mrg }
2196 1.1 mrg
2197 1.1 mrg
2198 1.1.1.2 mrg /* Line 2050 of yacc.c */
2199 1.1.1.3 mrg #line 264 "../../../gmp/demos/calc/calc.y"
2200 1.1 mrg
2201 1.1 mrg
2202 1.1 mrg yyerror (char *s)
2203 1.1 mrg {
2204 1.1 mrg fprintf (stderr, "%s\n", s);
2205 1.1 mrg }
2206 1.1 mrg
2207 1.1 mrg int calc_option_readline = -1;
2208 1.1 mrg
2209 1.1 mrg int
2210 1.1 mrg main (int argc, char *argv[])
2211 1.1 mrg {
2212 1.1 mrg int i;
2213 1.1 mrg
2214 1.1 mrg for (i = 1; i < argc; i++)
2215 1.1 mrg {
2216 1.1 mrg if (strcmp (argv[i], "--readline") == 0)
2217 1.1 mrg calc_option_readline = 1;
2218 1.1 mrg else if (strcmp (argv[i], "--noreadline") == 0)
2219 1.1 mrg calc_option_readline = 0;
2220 1.1 mrg else if (strcmp (argv[i], "--help") == 0)
2221 1.1 mrg {
2222 1.1 mrg printf ("Usage: calc [--option]...\n");
2223 1.1 mrg printf (" --readline use readline\n");
2224 1.1 mrg printf (" --noreadline don't use readline\n");
2225 1.1 mrg printf (" --help this message\n");
2226 1.1 mrg printf ("Readline is only available when compiled in,\n");
2227 1.1 mrg printf ("and in that case it's the default on a tty.\n");
2228 1.1 mrg exit (0);
2229 1.1 mrg }
2230 1.1 mrg else
2231 1.1 mrg {
2232 1.1 mrg fprintf (stderr, "Unrecognised option: %s\n", argv[i]);
2233 1.1 mrg exit (1);
2234 1.1 mrg }
2235 1.1 mrg }
2236 1.1 mrg
2237 1.1 mrg #if WITH_READLINE
2238 1.1 mrg calc_init_readline ();
2239 1.1 mrg #else
2240 1.1 mrg if (calc_option_readline == 1)
2241 1.1 mrg {
2242 1.1 mrg fprintf (stderr, "Readline support not available\n");
2243 1.1 mrg exit (1);
2244 1.1 mrg }
2245 1.1 mrg #endif
2246 1.1 mrg
2247 1.1 mrg for (i = 0; i < numberof (variable); i++)
2248 1.1 mrg mpz_init (variable[i]);
2249 1.1 mrg
2250 1.1 mrg for (i = 0; i < numberof (stack); i++)
2251 1.1 mrg mpz_init (stack[i]);
2252 1.1 mrg
2253 1.1 mrg return yyparse ();
2254 1.1 mrg }
2255