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