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