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