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