]> git.saurik.com Git - bison.git/blob - src/bison.simple
(output): Do not output "#include <stdio.h>"; that is bison.simple's
[bison.git] / src / bison.simple
1 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2 #line
3 /* Skeleton output parser for bison,
4 Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
25
26 /* This is the parser code that is written into each bison parser when
27 the %semantic_parser declaration is not specified in the grammar.
28 It was written by Richard Stallman by simplifying the hairy parser
29 used when %semantic_parser is specified. */
30
31 /* All symbols defined below should begin with yy or YY, to avoid
32 infringing on user name space. This should be done even for local
33 variables, as they might otherwise be expanded by user macros.
34 There are some unavoidable exceptions within include files to
35 define necessary library symbols; they are noted "INFRINGES ON
36 USER NAME SPACE" below. */
37
38 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
39
40 /* The parser invokes alloca or malloc; define the necessary symbols. */
41
42 # if YYSTACK_USE_ALLOCA
43 # define YYSTACK_ALLOC alloca
44 # define YYSIZE_T size_t
45 # else
46 # ifndef YYSTACK_USE_ALLOCA
47 # if defined (alloca) || defined (_ALLOCA_H)
48 # define YYSTACK_ALLOC alloca
49 # define YYSIZE_T size_t
50 # else
51 # if defined (__GNUC__) || defined (_AIX) || defined (__hpux)
52 # define YYSTACK_ALLOC __builtin_alloca
53 # endif
54 # ifndef __GNUC__
55 # ifdef _AIX
56 # pragma alloca
57 # endif
58 # if defined (__sgi) || defined (__sparc__) || defined (__sparc) || defined (__sun)
59 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
60 # define YYSTACK_ALLOC alloca
61 # define YYSIZE_T size_t
62 # endif
63 # endif
64 # endif
65 # endif
66 # endif
67
68 # ifdef YYSTACK_ALLOC
69 /* Pacify GCC's `empty if-body' warning. */
70 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
71 # else
72 # ifdef __cplusplus
73 # include <cstdlib> /* INFRINGES ON USER NAME SPACE */
74 # define YYSIZE_T std::size_t
75 # define YYSTACK_ALLOC std::malloc
76 # define YYSTACK_FREE std::free
77 # else
78 # ifdef __STDC__
79 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
80 # define YYSIZE_T size_t
81 # endif
82 # define YYSTACK_ALLOC malloc
83 # define YYSTACK_FREE free
84 # endif
85 # endif
86
87 /* A type that is properly aligned for any stack member. */
88 union yyalloc
89 {
90 short yyss;
91 YYSTYPE yyvs;
92 # if YYLSP_NEEDED
93 YYLTYPE yyls;
94 # endif
95 };
96
97 /* The size of the maximum gap between one aligned stack and the next. */
98 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
99
100 /* The size of an array large to enough to hold all stacks, each with
101 N elements. */
102 # if YYLSP_NEEDED
103 # define YYSTACK_BYTES(N) \
104 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
105 + 2 * YYSTACK_GAP_MAX)
106 # else
107 # define YYSTACK_BYTES(N) \
108 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
109 + YYSTACK_GAP_MAX)
110 # endif
111
112 /* Relocate the TYPE STACK from its old location to the new one. The
113 local variables YYSIZE and YYSTACKSIZE give the old and new number of
114 elements in the stack, and YYPTR gives the new location of the
115 stack. Advance YYPTR to a properly aligned location for the next
116 stack. */
117 # define YYSTACK_RELOCATE(Type, Stack) \
118 do \
119 { \
120 YYSIZE_T yynewbytes; \
121 yymemcpy ((char *) yyptr, (char *) (Stack), \
122 yysize * (YYSIZE_T) sizeof (Type)); \
123 Stack = &yyptr->Stack; \
124 yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
125 yyptr += yynewbytes / sizeof (*yyptr); \
126 } \
127 while (0)
128
129 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
130
131
132 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
133 # define YYSIZE_T __SIZE_TYPE__
134 #endif
135 #if ! defined (YYSIZE_T) && defined (size_t)
136 # define YYSIZE_T size_t
137 #endif
138 #if ! defined (YYSIZE_T)
139 # ifdef __cplusplus
140 # include <cstddef> /* INFRINGES ON USER NAME SPACE */
141 # define YYSIZE_T std::size_t
142 # else
143 # ifdef __STDC__
144 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
145 # define YYSIZE_T size_t
146 # endif
147 # endif
148 #endif
149 #if ! defined (YYSIZE_T)
150 # define YYSIZE_T unsigned int
151 #endif
152
153 #define yyerrok (yyerrstatus = 0)
154 #define yyclearin (yychar = YYEMPTY)
155 #define YYEMPTY -2
156 #define YYEOF 0
157 #define YYACCEPT goto yyacceptlab
158 #define YYABORT goto yyabortlab
159 #define YYERROR goto yyerrlab1
160 /* Like YYERROR except do call yyerror. This remains here temporarily
161 to ease the transition to the new meaning of YYERROR, for GCC.
162 Once GCC version 2 has supplanted version 1, this can go. */
163 #define YYFAIL goto yyerrlab
164 #define YYRECOVERING() (!!yyerrstatus)
165 #define YYBACKUP(Token, Value) \
166 do \
167 if (yychar == YYEMPTY && yylen == 1) \
168 { \
169 yychar = (Token); \
170 yylval = (Value); \
171 yychar1 = YYTRANSLATE (yychar); \
172 YYPOPSTACK; \
173 goto yybackup; \
174 } \
175 else \
176 { \
177 yyerror ("syntax error: cannot back up"); \
178 YYERROR; \
179 } \
180 while (0)
181
182 #define YYTERROR 1
183 #define YYERRCODE 256
184
185
186 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
187 are run).
188
189 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
190 first token. By default, to implement support for ranges, extend
191 its range to the last symbol. */
192
193 #ifndef YYLLOC_DEFAULT
194 # define YYLLOC_DEFAULT(Current, Rhs, N) \
195 Current.last_line = Rhs[N].last_line; \
196 Current.last_column = Rhs[N].last_column;
197 #endif
198
199
200 /* YYLEX -- calling `yylex' with the right arguments. */
201
202 #if YYPURE
203 # if YYLSP_NEEDED
204 # ifdef YYLEX_PARAM
205 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
206 # else
207 # define YYLEX yylex (&yylval, &yylloc)
208 # endif
209 # else /* !YYLSP_NEEDED */
210 # ifdef YYLEX_PARAM
211 # define YYLEX yylex (&yylval, YYLEX_PARAM)
212 # else
213 # define YYLEX yylex (&yylval)
214 # endif
215 # endif /* !YYLSP_NEEDED */
216 #else /* !YYPURE */
217 # define YYLEX yylex ()
218 #endif /* !YYPURE */
219
220
221 /* Enable debugging if requested. */
222 #if YYDEBUG
223
224 # ifndef YYFPRINTF
225 # ifdef __cplusplus
226 # include <cstdio.h> /* INFRINGES ON USER NAME SPACE */
227 # define YYFPRINTF std::fprintf
228 # define YYSTDERR std::stderr
229 # else
230 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
231 # define YYFPRINTF fprintf
232 # define YYSTDERR stderr
233 # endif
234 # endif
235
236 # define YYDPRINTF(Args) \
237 do { \
238 if (yydebug) \
239 YYFPRINTF Args; \
240 } while (0)
241 /* Nonzero means print parse trace. [The following comment makes no
242 sense to me. Could someone clarify it? --akim] Since this is
243 uninitialized, it does not stop multiple parsers from coexisting.
244 */
245 int yydebug;
246 #else /* !YYDEBUG */
247 # define YYDPRINTF(Args)
248 #endif /* !YYDEBUG */
249
250 /* YYINITDEPTH -- initial size of the parser's stacks. */
251 #ifndef YYINITDEPTH
252 # define YYINITDEPTH 200
253 #endif
254
255 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
256 if the built-in stack extension method is used).
257
258 Do not make this value too large; the results are undefined if
259 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
260 evaluated with infinite-precision integer arithmetic. */
261
262 #if YYMAXDEPTH == 0
263 # undef YYMAXDEPTH
264 #endif
265
266 #ifndef YYMAXDEPTH
267 # define YYMAXDEPTH 10000
268 #endif
269 \f
270 #if ! defined (yyoverflow) && ! defined (yymemcpy)
271 # if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
272 # define yymemcpy __builtin_memcpy
273 # else /* not GNU C or C++ */
274
275 /* This is the most reliable way to avoid incompatibilities
276 in available built-in functions on various systems. */
277 static void
278 # if defined (__STDC__) || defined (__cplusplus)
279 yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
280 # else
281 yymemcpy (yyto, yyfrom, yycount)
282 char *yyto;
283 const char *yyfrom;
284 YYSIZE_T yycount;
285 # endif
286 {
287 register const char *yyf = yyfrom;
288 register char *yyt = yyto;
289 register YYSIZE_T yyi = yycount;
290
291 while (yyi-- != 0)
292 *yyt++ = *yyf++;
293 }
294 # endif
295 #endif
296
297 #ifdef YYERROR_VERBOSE
298
299 # ifndef yystrlen
300 # if defined (__GLIBC__) && defined (_STRING_H)
301 # define yystrlen strlen
302 # else
303 /* Return the length of YYSTR. */
304 static YYSIZE_T
305 # if defined (__STDC__) || defined (__cplusplus)
306 yystrlen (const char *yystr)
307 # else
308 yystrlen (yystr)
309 const char *yystr;
310 # endif
311 {
312 register const char *yys = yystr;
313
314 while (*yys++ != '\0')
315 continue;
316
317 return yys - yystr - 1;
318 }
319 # endif
320 # endif
321
322 # ifndef yystpcpy
323 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
324 # define yystpcpy stpcpy
325 # else
326 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
327 YYDEST. */
328 static char *
329 # if defined (__STDC__) || defined (__cplusplus)
330 yystpcpy (char *yydest, const char *yysrc)
331 # else
332 yystpcpy (yydest, yysrc)
333 char *yydest;
334 const char *yysrc;
335 # endif
336 {
337 register char *yyd = yydest;
338 register const char *yys = yysrc;
339
340 while ((*yyd++ = *yys++) != '\0')
341 continue;
342
343 return yyd - 1;
344 }
345 # endif
346 # endif
347 #endif
348 \f
349 #line
350
351 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
352 into yyparse. The argument should have type void *.
353 It should actually point to an object.
354 Grammar actions can access the variable by casting it
355 to the proper pointer type. */
356
357 #ifdef YYPARSE_PARAM
358 # ifdef __cplusplus
359 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
360 # define YYPARSE_PARAM_DECL
361 # else /* !__cplusplus */
362 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
363 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
364 # endif /* !__cplusplus */
365 #else /* !YYPARSE_PARAM */
366 # define YYPARSE_PARAM_ARG
367 # define YYPARSE_PARAM_DECL
368 #endif /* !YYPARSE_PARAM */
369
370 /* Prevent warning if -Wstrict-prototypes. */
371 #ifdef __GNUC__
372 # ifdef YYPARSE_PARAM
373 int yyparse (void *);
374 # else
375 int yyparse (void);
376 # endif
377 #endif
378
379 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
380 variables are global, or local to YYPARSE. */
381
382 #define YY_DECL_NON_LSP_VARIABLES \
383 /* The lookahead symbol. */ \
384 int yychar; \
385 \
386 /* The semantic value of the lookahead symbol. */ \
387 YYSTYPE yylval; \
388 \
389 /* Number of parse errors so far. */ \
390 int yynerrs;
391
392 #if YYLSP_NEEDED
393 # define YY_DECL_VARIABLES \
394 YY_DECL_NON_LSP_VARIABLES \
395 \
396 /* Location data for the lookahead symbol. */ \
397 YYLTYPE yylloc;
398 #else
399 # define YY_DECL_VARIABLES \
400 YY_DECL_NON_LSP_VARIABLES
401 #endif
402
403
404 /* If nonreentrant, generate the variables here. */
405
406 #if !YYPURE
407 YY_DECL_VARIABLES
408 #endif /* !YYPURE */
409
410 int
411 yyparse (YYPARSE_PARAM_ARG)
412 YYPARSE_PARAM_DECL
413 {
414 /* If reentrant, generate the variables here. */
415 #if YYPURE
416 YY_DECL_VARIABLES
417 #endif /* !YYPURE */
418
419 register int yystate;
420 register int yyn;
421 int yyresult;
422 /* Number of tokens to shift before error messages enabled. */
423 int yyerrstatus;
424 /* Lookahead token as an internal (translated) token number. */
425 int yychar1 = 0;
426
427 /* Three stacks and their tools:
428 `yyss': related to states,
429 `yyvs': related to semantic values,
430 `yyls': related to locations.
431
432 Refer to the stacks thru separate pointers, to allow yyoverflow
433 to reallocate them elsewhere. */
434
435 /* The state stack. */
436 short yyssa[YYINITDEPTH];
437 short *yyss = yyssa;
438 register short *yyssp;
439
440 /* The semantic value stack. */
441 YYSTYPE yyvsa[YYINITDEPTH];
442 YYSTYPE *yyvs = yyvsa;
443 register YYSTYPE *yyvsp;
444
445 #if YYLSP_NEEDED
446 /* The location stack. */
447 YYLTYPE yylsa[YYINITDEPTH];
448 YYLTYPE *yyls = yylsa;
449 YYLTYPE *yylsp;
450 #endif
451
452 #if YYLSP_NEEDED
453 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
454 #else
455 # define YYPOPSTACK (yyvsp--, yyssp--)
456 #endif
457
458 YYSIZE_T yystacksize = YYINITDEPTH;
459
460
461 /* The variables used to return semantic value and location from the
462 action routines. */
463 YYSTYPE yyval;
464 #if YYLSP_NEEDED
465 YYLTYPE yyloc;
466 #endif
467
468 /* When reducing, the number of symbols on the RHS of the reduced
469 rule. */
470 int yylen;
471
472 YYDPRINTF ((YYSTDERR, "Starting parse\n"));
473
474 yystate = 0;
475 yyerrstatus = 0;
476 yynerrs = 0;
477 yychar = YYEMPTY; /* Cause a token to be read. */
478
479 /* Initialize stack pointers.
480 Waste one element of value and location stack
481 so that they stay on the same level as the state stack.
482 The wasted elements are never initialized. */
483
484 yyssp = yyss;
485 yyvsp = yyvs;
486 #if YYLSP_NEEDED
487 yylsp = yyls;
488 #endif
489 goto yysetstate;
490
491 /*------------------------------------------------------------.
492 | yynewstate -- Push a new state, which is found in yystate. |
493 `------------------------------------------------------------*/
494 yynewstate:
495 /* In all cases, when you get here, the value and location stacks
496 have just been pushed. so pushing a state here evens the stacks.
497 */
498 yyssp++;
499
500 yysetstate:
501 *yyssp = yystate;
502
503 if (yyssp >= yyss + yystacksize - 1)
504 {
505 /* Get the current used size of the three stacks, in elements. */
506 YYSIZE_T yysize = yyssp - yyss + 1;
507
508 #ifdef yyoverflow
509 {
510 /* Give user a chance to reallocate the stack. Use copies of
511 these so that the &'s don't force the real ones into
512 memory. */
513 YYSTYPE *yyvs1 = yyvs;
514 short *yyss1 = yyss;
515
516 /* Each stack pointer address is followed by the size of the
517 data in use in that stack, in bytes. */
518 # if YYLSP_NEEDED
519 YYLTYPE *yyls1 = yyls;
520 /* This used to be a conditional around just the two extra args,
521 but that might be undefined if yyoverflow is a macro. */
522 yyoverflow ("parser stack overflow",
523 &yyss1, yysize * sizeof (*yyssp),
524 &yyvs1, yysize * sizeof (*yyvsp),
525 &yyls1, yysize * sizeof (*yylsp),
526 &yystacksize);
527 yyls = yyls1;
528 # else
529 yyoverflow ("parser stack overflow",
530 &yyss1, yysize * sizeof (*yyssp),
531 &yyvs1, yysize * sizeof (*yyvsp),
532 &yystacksize);
533 # endif
534 yyss = yyss1;
535 yyvs = yyvs1;
536 }
537 #else /* no yyoverflow */
538 /* Extend the stack our own way. */
539 if (yystacksize >= YYMAXDEPTH)
540 goto yyoverflowlab;
541 yystacksize *= 2;
542 if (yystacksize > YYMAXDEPTH)
543 yystacksize = YYMAXDEPTH;
544
545 {
546 short *yyss1 = yyss;
547 union yyalloc *yyptr =
548 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
549 if (! yyptr)
550 goto yyoverflowlab;
551 YYSTACK_RELOCATE (short, yyss);
552 YYSTACK_RELOCATE (YYSTYPE, yyvs);
553 # if YYLSP_NEEDED
554 YYSTACK_RELOCATE (YYLTYPE, yyls);
555 # endif
556 # undef YYSTACK_RELOCATE
557 if (yyss1 != yyssa)
558 YYSTACK_FREE (yyss1);
559 }
560 #endif /* no yyoverflow */
561
562 yyssp = yyss + yysize - 1;
563 yyvsp = yyvs + yysize - 1;
564 #if YYLSP_NEEDED
565 yylsp = yyls + yysize - 1;
566 #endif
567
568 YYDPRINTF ((YYSTDERR, "Stack size increased to %lu\n",
569 (unsigned long int) yystacksize));
570
571 if (yyssp >= yyss + yystacksize - 1)
572 YYABORT;
573 }
574
575 YYDPRINTF ((YYSTDERR, "Entering state %d\n", yystate));
576
577 goto yybackup;
578
579
580 /*-----------.
581 | yybackup. |
582 `-----------*/
583 yybackup:
584
585 /* Do appropriate processing given the current state. */
586 /* Read a lookahead token if we need one and don't already have one. */
587 /* yyresume: */
588
589 /* First try to decide what to do without reference to lookahead token. */
590
591 yyn = yypact[yystate];
592 if (yyn == YYFLAG)
593 goto yydefault;
594
595 /* Not known => get a lookahead token if don't already have one. */
596
597 /* yychar is either YYEMPTY or YYEOF
598 or a valid token in external form. */
599
600 if (yychar == YYEMPTY)
601 {
602 YYDPRINTF ((YYSTDERR, "Reading a token: "));
603 yychar = YYLEX;
604 }
605
606 /* Convert token to internal form (in yychar1) for indexing tables with */
607
608 if (yychar <= 0) /* This means end of input. */
609 {
610 yychar1 = 0;
611 yychar = YYEOF; /* Don't call YYLEX any more */
612
613 YYDPRINTF ((YYSTDERR, "Now at end of input.\n"));
614 }
615 else
616 {
617 yychar1 = YYTRANSLATE (yychar);
618
619 #if YYDEBUG
620 /* We have to keep this `#if YYDEBUG', since we use variables
621 which are defined only if `YYDEBUG' is set. */
622 if (yydebug)
623 {
624 YYFPRINTF (YYSTDERR, "Next token is %d (%s",
625 yychar, yytname[yychar1]);
626 /* Give the individual parser a way to print the precise
627 meaning of a token, for further debugging info. */
628 # ifdef YYPRINT
629 YYPRINT (YYSTDERR, yychar, yylval);
630 # endif
631 YYFPRINTF (YYSTDERR, ")\n");
632 }
633 #endif
634 }
635
636 yyn += yychar1;
637 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
638 goto yydefault;
639
640 yyn = yytable[yyn];
641
642 /* yyn is what to do for this token type in this state.
643 Negative => reduce, -yyn is rule number.
644 Positive => shift, yyn is new state.
645 New state is final state => don't bother to shift,
646 just return success.
647 0, or most negative number => error. */
648
649 if (yyn < 0)
650 {
651 if (yyn == YYFLAG)
652 goto yyerrlab;
653 yyn = -yyn;
654 goto yyreduce;
655 }
656 else if (yyn == 0)
657 goto yyerrlab;
658
659 if (yyn == YYFINAL)
660 YYACCEPT;
661
662 /* Shift the lookahead token. */
663 YYDPRINTF ((YYSTDERR, "Shifting token %d (%s), ",
664 yychar, yytname[yychar1]));
665
666 /* Discard the token being shifted unless it is eof. */
667 if (yychar != YYEOF)
668 yychar = YYEMPTY;
669
670 *++yyvsp = yylval;
671 #if YYLSP_NEEDED
672 *++yylsp = yylloc;
673 #endif
674
675 /* Count tokens shifted since error; after three, turn off error
676 status. */
677 if (yyerrstatus)
678 yyerrstatus--;
679
680 yystate = yyn;
681 goto yynewstate;
682
683
684 /*-----------------------------------------------------------.
685 | yydefault -- do the default action for the current state. |
686 `-----------------------------------------------------------*/
687 yydefault:
688 yyn = yydefact[yystate];
689 if (yyn == 0)
690 goto yyerrlab;
691 goto yyreduce;
692
693
694 /*-----------------------------.
695 | yyreduce -- Do a reduction. |
696 `-----------------------------*/
697 yyreduce:
698 /* yyn is the number of a rule to reduce with. */
699 yylen = yyr2[yyn];
700
701 /* If YYLEN is nonzero, implement the default value of the action:
702 `$$ = $1'.
703
704 Otherwise, the following line sets YYVAL to the semantic value of
705 the lookahead token. This behavior is undocumented and Bison
706 users should not rely upon it. Assigning to YYVAL
707 unconditionally makes the parser a bit smaller, and it avoids a
708 GCC warning that YYVAL may be used uninitialized. */
709 yyval = yyvsp[1-yylen];
710
711 #if YYLSP_NEEDED
712 /* Similarly for the default location. Let the user run additional
713 commands if for instance locations are ranges. */
714 yyloc = yylsp[1-yylen];
715 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
716 #endif
717
718 #if YYDEBUG
719 /* We have to keep this `#if YYDEBUG', since we use variables which
720 are defined only if `YYDEBUG' is set. */
721 if (yydebug)
722 {
723 int yyi;
724
725 YYFPRINTF (YYSTDERR, "Reducing via rule %d (line %d), ",
726 yyn, yyrline[yyn]);
727
728 /* Print the symbols being reduced, and their result. */
729 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
730 YYFPRINTF (YYSTDERR, "%s ", yytname[yyrhs[yyi]]);
731 YYFPRINTF (YYSTDERR, " -> %s\n", yytname[yyr1[yyn]]);
732 }
733 #endif
734 %% actions /* The action file replaces this line. */
735 #line
736 \f
737 yyvsp -= yylen;
738 yyssp -= yylen;
739 #if YYLSP_NEEDED
740 yylsp -= yylen;
741 #endif
742
743 #if YYDEBUG
744 if (yydebug)
745 {
746 short *yyssp1 = yyss - 1;
747 YYFPRINTF (YYSTDERR, "state stack now");
748 while (yyssp1 != yyssp)
749 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
750 YYFPRINTF (YYSTDERR, "\n");
751 }
752 #endif
753
754 *++yyvsp = yyval;
755 #if YYLSP_NEEDED
756 *++yylsp = yyloc;
757 #endif
758
759 /* Now `shift' the result of the reduction. Determine what state
760 that goes to, based on the state we popped back to and the rule
761 number reduced by. */
762
763 yyn = yyr1[yyn];
764
765 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
766 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
767 yystate = yytable[yystate];
768 else
769 yystate = yydefgoto[yyn - YYNTBASE];
770
771 goto yynewstate;
772
773
774 /*------------------------------------.
775 | yyerrlab -- here on detecting error |
776 `------------------------------------*/
777 yyerrlab:
778 /* If not already recovering from an error, report this error. */
779 if (!yyerrstatus)
780 {
781 ++yynerrs;
782
783 #ifdef YYERROR_VERBOSE
784 yyn = yypact[yystate];
785
786 if (yyn > YYFLAG && yyn < YYLAST)
787 {
788 YYSIZE_T yysize = 0;
789 char *yymsg;
790 int yyx, yycount;
791
792 yycount = 0;
793 /* Start YYX at -YYN if negative to avoid negative indexes in
794 YYCHECK. */
795 for (yyx = yyn < 0 ? -yyn : 0;
796 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
797 if (yycheck[yyx + yyn] == yyx)
798 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
799 yysize += yystrlen ("parse error, unexpected ") + 1;
800 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
801 yymsg = (char *) YYSTACK_ALLOC (yysize);
802 if (yymsg != 0)
803 {
804 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
805 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
806
807 if (yycount < 5)
808 {
809 yycount = 0;
810 for (yyx = yyn < 0 ? -yyn : 0;
811 yyx < (int) (sizeof (yytname) / sizeof (char *));
812 yyx++)
813 if (yycheck[yyx + yyn] == yyx)
814 {
815 const char *yyq = ! yycount ? ", expecting " : " or ";
816 yyp = yystpcpy (yyp, yyq);
817 yyp = yystpcpy (yyp, yytname[yyx]);
818 yycount++;
819 }
820 }
821 yyerror (yymsg);
822 YYSTACK_FREE (yymsg);
823 }
824 else
825 yyerror ("parse error; also virtual memory exhausted");
826 }
827 else
828 #endif /* defined (YYERROR_VERBOSE) */
829 yyerror ("parse error");
830 }
831 goto yyerrlab1;
832
833
834 /*--------------------------------------------------.
835 | yyerrlab1 -- error raised explicitly by an action |
836 `--------------------------------------------------*/
837 yyerrlab1:
838 if (yyerrstatus == 3)
839 {
840 /* If just tried and failed to reuse lookahead token after an
841 error, discard it. */
842
843 /* return failure if at end of input */
844 if (yychar == YYEOF)
845 YYABORT;
846 YYDPRINTF ((YYSTDERR, "Discarding token %d (%s).\n",
847 yychar, yytname[yychar1]));
848 yychar = YYEMPTY;
849 }
850
851 /* Else will try to reuse lookahead token after shifting the error
852 token. */
853
854 yyerrstatus = 3; /* Each real token shifted decrements this */
855
856 goto yyerrhandle;
857
858
859 /*-------------------------------------------------------------------.
860 | yyerrdefault -- current state does not do anything special for the |
861 | error token. |
862 `-------------------------------------------------------------------*/
863 yyerrdefault:
864 #if 0
865 /* This is wrong; only states that explicitly want error tokens
866 should shift them. */
867
868 /* If its default is to accept any token, ok. Otherwise pop it. */
869 yyn = yydefact[yystate];
870 if (yyn)
871 goto yydefault;
872 #endif
873
874
875 /*---------------------------------------------------------------.
876 | yyerrpop -- pop the current state because it cannot handle the |
877 | error token |
878 `---------------------------------------------------------------*/
879 yyerrpop:
880 if (yyssp == yyss)
881 YYABORT;
882 yyvsp--;
883 yystate = *--yyssp;
884 #if YYLSP_NEEDED
885 yylsp--;
886 #endif
887
888 #if YYDEBUG
889 if (yydebug)
890 {
891 short *yyssp1 = yyss - 1;
892 YYFPRINTF (YYSTDERR, "Error: state stack now");
893 while (yyssp1 != yyssp)
894 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
895 YYFPRINTF (YYSTDERR, "\n");
896 }
897 #endif
898
899 /*--------------.
900 | yyerrhandle. |
901 `--------------*/
902 yyerrhandle:
903 yyn = yypact[yystate];
904 if (yyn == YYFLAG)
905 goto yyerrdefault;
906
907 yyn += YYTERROR;
908 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
909 goto yyerrdefault;
910
911 yyn = yytable[yyn];
912 if (yyn < 0)
913 {
914 if (yyn == YYFLAG)
915 goto yyerrpop;
916 yyn = -yyn;
917 goto yyreduce;
918 }
919 else if (yyn == 0)
920 goto yyerrpop;
921
922 if (yyn == YYFINAL)
923 YYACCEPT;
924
925 YYDPRINTF ((YYSTDERR, "Shifting error token, "));
926
927 *++yyvsp = yylval;
928 #if YYLSP_NEEDED
929 *++yylsp = yylloc;
930 #endif
931
932 yystate = yyn;
933 goto yynewstate;
934
935
936 /*-------------------------------------.
937 | yyacceptlab -- YYACCEPT comes here. |
938 `-------------------------------------*/
939 yyacceptlab:
940 yyresult = 0;
941 goto yyreturn;
942
943 /*-----------------------------------.
944 | yyabortlab -- YYABORT comes here. |
945 `-----------------------------------*/
946 yyabortlab:
947 yyresult = 1;
948 goto yyreturn;
949
950 /*---------------------------------------------.
951 | yyoverflowab -- parser overflow comes here. |
952 `---------------------------------------------*/
953 yyoverflowlab:
954 yyerror ("parser stack overflow");
955 yyresult = 2;
956 /* Fall through. */
957
958 yyreturn:
959 #ifndef yyoverflow
960 if (yyss != yyssa)
961 YYSTACK_FREE (yyss);
962 #endif
963 return yyresult;
964 }