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