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