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