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