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