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