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