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