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