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