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