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