]> git.saurik.com Git - bison.git/blob - src/bison.simple
cc349befb40d14525e812af87331564d43ec426e
[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 /* 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 (yyptr, (char *) (Stack), \
176 yysize * (YYSIZE_T) sizeof (Type)); \
177 (Stack) = (Type *) yyptr; \
178 yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
179 yynewbytes -= yynewbytes % sizeof (union yyalloc); \
180 yyptr += yynewbytes; \
181 } \
182 while (0)
183
184 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
185
186 /* Tokens. */
187 %%tokendef
188
189 #define YYFINAL %%final
190 #define YYFLAG %%flag
191 #define YYNTBASE %%ntbase
192 #define YYLAST %%last
193
194 #define YYNTOKENS %%ntokens
195 #define YYNNTS %%nnts
196 #define YYNRULES %%nrules
197 #define YYNSTATES %%nstates
198 #define YYMAXUTOK %%maxtok
199
200 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
201 #define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym)
202
203 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
204 static const char yytranslate[] =
205 {
206 %%translate
207 };
208
209 #if YYDEBUG
210 static const short yyprhs[] =
211 {
212 %%prhs
213 };
214
215 static const short yyrhs[] =
216 {
217 %%rhs
218 };
219
220 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
221 static const short yyrline[] =
222 {
223 %%rline
224 };
225 #endif
226
227 #if YYDEBUG || YYERROR_VERBOSE
228 /* YYTNME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
229 static const char *const yytname[] =
230 {
231 %%tname
232 };
233 #endif
234
235 /* YYTOKNUM[YYN] -- Index in YYTNAME corresponding to YYLEX. */
236 static const short yytoknum[] =
237 {
238 %%toknum
239 };
240
241 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
242 static const short yyr1[] =
243 {
244 %%r1
245 };
246
247 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
248 static const short yyr2[] =
249 {
250 %%r2
251 };
252
253 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
254 doesn't specify something else to do. Zero means the default is an
255 error. */
256 static const short yydefact[] =
257 {
258 %%defact
259 };
260
261 static const short yydefgoto[] =
262 {
263 %%defgoto
264 };
265
266 static const short yypact[] =
267 {
268 %%pact
269 };
270
271 static const short yypgoto[] =
272 {
273 %%pgoto
274 };
275
276 static const short yytable[] =
277 {
278 %%table
279 };
280
281 static const short yycheck[] =
282 {
283 %%check
284 };
285
286
287 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
288 # define YYSIZE_T __SIZE_TYPE__
289 #endif
290 #if ! defined (YYSIZE_T) && defined (size_t)
291 # define YYSIZE_T size_t
292 #endif
293 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
294 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
295 # define YYSIZE_T size_t
296 #endif
297 #if ! defined (YYSIZE_T)
298 # define YYSIZE_T unsigned int
299 #endif
300
301 #define yyerrok (yyerrstatus = 0)
302 #define yyclearin (yychar = YYEMPTY)
303 #define YYEMPTY -2
304 #define YYEOF 0
305
306 #define YYACCEPT goto yyacceptlab
307 #define YYABORT goto yyabortlab
308 #define YYERROR goto yyerrlab1
309
310 /* Like YYERROR except do call yyerror. This remains here temporarily
311 to ease the transition to the new meaning of YYERROR, for GCC.
312 Once GCC version 2 has supplanted version 1, this can go. */
313
314 #define YYFAIL goto yyerrlab
315
316 #define YYRECOVERING() (!!yyerrstatus)
317
318 #define YYBACKUP(Token, Value) \
319 do \
320 if (yychar == YYEMPTY && yylen == 1) \
321 { \
322 yychar = (Token); \
323 yylval = (Value); \
324 yychar1 = YYTRANSLATE (yychar); \
325 YYPOPSTACK; \
326 goto yybackup; \
327 } \
328 else \
329 { \
330 yyerror ("syntax error: cannot back up"); \
331 YYERROR; \
332 } \
333 while (0)
334
335 #define YYTERROR 1
336 #define YYERRCODE 256
337
338 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
339 are run).
340
341 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
342 first token. By default, to implement support for ranges, extend
343 its range to the last symbol. */
344
345 #ifndef YYLLOC_DEFAULT
346 # define YYLLOC_DEFAULT(Current, Rhs, N) \
347 Current.last_line = Rhs[N].last_line; \
348 Current.last_column = Rhs[N].last_column;
349 #endif
350
351 /* YYLEX -- calling `yylex' with the right arguments. */
352
353 #if YYPURE
354 # if YYLSP_NEEDED
355 # ifdef YYLEX_PARAM
356 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
357 # else
358 # define YYLEX yylex (&yylval, &yylloc)
359 # endif
360 # else /* !YYLSP_NEEDED */
361 # ifdef YYLEX_PARAM
362 # define YYLEX yylex (&yylval, YYLEX_PARAM)
363 # else
364 # define YYLEX yylex (&yylval)
365 # endif
366 # endif /* !YYLSP_NEEDED */
367 #else /* !YYPURE */
368 # define YYLEX yylex ()
369 #endif /* !YYPURE */
370
371 /* Enable debugging if requested. */
372 #if YYDEBUG
373 # include <stdio.h>
374 # define YYDPRINTF(Args) \
375 do { \
376 if (yydebug) \
377 fprintf Args; \
378 } while (0)
379 /* Nonzero means print parse trace. [The following comment makes no
380 sense to me. Could someone clarify it? --akim] Since this is
381 uninitialized, it does not stop multiple parsers from coexisting.
382 */
383 int yydebug;
384 #else /* !YYDEBUG */
385 # define YYDPRINTF(Args)
386 #endif /* !YYDEBUG */
387
388 /* YYINITDEPTH -- initial size of the parser's stacks. */
389 #ifndef YYINITDEPTH
390 # define YYINITDEPTH %%initdepth
391 #endif
392
393 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
394 if the built-in stack extension method is used).
395
396 Do not make this value too large; the results are undefined if
397 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
398 evaluated with infinite-precision integer arithmetic. */
399
400 #if YYMAXDEPTH == 0
401 # undef YYMAXDEPTH
402 #endif
403
404 #ifndef YYMAXDEPTH
405 # define YYMAXDEPTH %%maxdepth
406 #endif
407
408 \f
409
410 #if ! defined (yyoverflow) && ! defined (yymemcpy)
411 # if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
412 # define yymemcpy __builtin_memcpy
413 # else /* not GNU C or C++ */
414
415 /* This is the most reliable way to avoid incompatibilities
416 in available built-in functions on various systems. */
417 static void
418 # if defined (__STDC__) || defined (__cplusplus)
419 yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
420 # else
421 yymemcpy (yyto, yyfrom, yycount)
422 char *yyto;
423 const char *yyfrom;
424 YYSIZE_T yycount;
425 # endif
426 {
427 register const char *yyf = yyfrom;
428 register char *yyt = yyto;
429 register YYSIZE_T yyi = yycount;
430
431 while (yyi-- != 0)
432 *yyt++ = *yyf++;
433 }
434 # endif
435 #endif
436
437 #if YYERROR_VERBOSE
438
439 # ifndef yystrlen
440 # if defined (__GLIBC__) && defined (_STRING_H)
441 # define yystrlen strlen
442 # else
443 /* Return the length of YYSTR. */
444 static YYSIZE_T
445 # if defined (__STDC__) || defined (__cplusplus)
446 yystrlen (const char *yystr)
447 # else
448 yystrlen (yystr)
449 const char *yystr;
450 # endif
451 {
452 register const char *yys = yystr;
453
454 while (*yys++ != '\0')
455 continue;
456
457 return yys - yystr - 1;
458 }
459 # endif
460 # endif
461
462 # ifndef yystpcpy
463 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
464 # define yystpcpy stpcpy
465 # else
466 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
467 YYDEST. */
468 static char *
469 # ifndef __cplusplus
470 yystpcpy (yydest, yysrc)
471 char *yydest;
472 const char *yysrc;
473 # else
474 yystpcpy (char *yydest, const char *yysrc)
475 # endif
476 {
477 register char *yyd = yydest;
478 register const char *yys = yysrc;
479
480 while ((*yyd++ = *yys++) != '\0')
481 continue;
482
483 return yyd - 1;
484 }
485 # endif
486 # endif
487
488 #endif /* !YYERROR_VERBOSE */
489
490 \f
491
492 #line %%line "%%skeleton"
493
494 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
495 into yyparse. The argument should have type void *.
496 It should actually point to an object.
497 Grammar actions can access the variable by casting it
498 to the proper pointer type. */
499
500 #ifdef YYPARSE_PARAM
501 # ifdef __cplusplus
502 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
503 # define YYPARSE_PARAM_DECL
504 # else /* !__cplusplus */
505 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
506 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
507 # endif /* !__cplusplus */
508 #else /* !YYPARSE_PARAM */
509 # define YYPARSE_PARAM_ARG
510 # define YYPARSE_PARAM_DECL
511 #endif /* !YYPARSE_PARAM */
512
513 /* Prevent warning if -Wstrict-prototypes. */
514 #ifdef __GNUC__
515 # ifdef YYPARSE_PARAM
516 int yyparse (void *);
517 # else
518 int yyparse (void);
519 # endif
520 #endif
521
522 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
523 variables are global, or local to YYPARSE. */
524
525 #define YY_DECL_NON_LSP_VARIABLES \
526 /* The lookahead symbol. */ \
527 int yychar; \
528 \
529 /* The semantic value of the lookahead symbol. */ \
530 YYSTYPE yylval; \
531 \
532 /* Number of parse errors so far. */ \
533 int yynerrs;
534
535 #if YYLSP_NEEDED
536 # define YY_DECL_VARIABLES \
537 YY_DECL_NON_LSP_VARIABLES \
538 \
539 /* Location data for the lookahead symbol. */ \
540 YYLTYPE yylloc;
541 #else
542 # define YY_DECL_VARIABLES \
543 YY_DECL_NON_LSP_VARIABLES
544 #endif
545
546 /* If nonreentrant, generate the variables here. */
547
548 #if !YYPURE
549 YY_DECL_VARIABLES
550 #endif /* !YYPURE */
551
552 int
553 yyparse (YYPARSE_PARAM_ARG)
554 YYPARSE_PARAM_DECL
555 {
556 /* If reentrant, generate the variables here. */
557 #if YYPURE
558 YY_DECL_VARIABLES
559 #endif /* !YYPURE */
560
561 register int yystate;
562 register int yyn;
563 int yyresult;
564 /* Number of tokens to shift before error messages enabled. */
565 int yyerrstatus;
566 /* Lookahead token as an internal (translated) token number. */
567 int yychar1 = 0;
568
569 /* Three stacks and their tools:
570 `yyss': related to states,
571 `yyvs': related to semantic values,
572 `yyls': related to locations.
573
574 Refer to the stacks thru separate pointers, to allow yyoverflow
575 to reallocate them elsewhere. */
576
577 /* The state stack. */
578 short yyssa[YYINITDEPTH];
579 short *yyss = yyssa;
580 register short *yyssp;
581
582 /* The semantic value stack. */
583 YYSTYPE yyvsa[YYINITDEPTH];
584 YYSTYPE *yyvs = yyvsa;
585 register YYSTYPE *yyvsp;
586
587 #if YYLSP_NEEDED
588 /* The location stack. */
589 YYLTYPE yylsa[YYINITDEPTH];
590 YYLTYPE *yyls = yylsa;
591 YYLTYPE *yylsp;
592 #endif
593
594 #if YYLSP_NEEDED
595 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
596 #else
597 # define YYPOPSTACK (yyvsp--, yyssp--)
598 #endif
599
600 YYSIZE_T yystacksize = YYINITDEPTH;
601
602 /* The variables used to return semantic value and location from the
603 action routines. */
604 YYSTYPE yyval;
605 #if YYLSP_NEEDED
606 YYLTYPE yyloc;
607 #endif
608
609 /* When reducing, the number of symbols on the RHS of the reduced
610 rule. */
611 int yylen;
612
613 YYDPRINTF ((stderr, "Starting parse\n"));
614
615 yystate = 0;
616 yyerrstatus = 0;
617 yynerrs = 0;
618 yychar = YYEMPTY; /* Cause a token to be read. */
619
620 /* Initialize stack pointers.
621 Waste one element of value and location stack
622 so that they stay on the same level as the state stack.
623 The wasted elements are never initialized. */
624
625 yyssp = yyss;
626 yyvsp = yyvs;
627 #if YYLSP_NEEDED
628 yylsp = yyls;
629 #endif
630 goto yysetstate;
631
632 /*------------------------------------------------------------.
633 | yynewstate -- Push a new state, which is found in yystate. |
634 `------------------------------------------------------------*/
635 yynewstate:
636 /* In all cases, when you get here, the value and location stacks
637 have just been pushed. so pushing a state here evens the stacks.
638 */
639 yyssp++;
640
641 yysetstate:
642 *yyssp = yystate;
643
644 if (yyssp >= yyss + yystacksize - 1)
645 {
646 /* Get the current used size of the three stacks, in elements. */
647 YYSIZE_T yysize = yyssp - yyss + 1;
648
649 #ifdef yyoverflow
650 {
651 /* Give user a chance to reallocate the stack. Use copies of
652 these so that the &'s don't force the real ones into
653 memory. */
654 YYSTYPE *yyvs1 = yyvs;
655 short *yyss1 = yyss;
656
657 /* Each stack pointer address is followed by the size of the
658 data in use in that stack, in bytes. */
659 # if YYLSP_NEEDED
660 YYLTYPE *yyls1 = yyls;
661 /* This used to be a conditional around just the two extra args,
662 but that might be undefined if yyoverflow is a macro. */
663 yyoverflow ("parser stack overflow",
664 &yyss1, yysize * sizeof (*yyssp),
665 &yyvs1, yysize * sizeof (*yyvsp),
666 &yyls1, yysize * sizeof (*yylsp),
667 &yystacksize);
668 yyls = yyls1;
669 # else
670 yyoverflow ("parser stack overflow",
671 &yyss1, yysize * sizeof (*yyssp),
672 &yyvs1, yysize * sizeof (*yyvsp),
673 &yystacksize);
674 # endif
675 yyss = yyss1;
676 yyvs = yyvs1;
677 }
678 #else /* no yyoverflow */
679 /* Extend the stack our own way. */
680 if (yystacksize >= YYMAXDEPTH)
681 goto yyoverflowlab;
682 yystacksize *= 2;
683 if (yystacksize > YYMAXDEPTH)
684 yystacksize = YYMAXDEPTH;
685
686 {
687 short *yyss1 = yyss;
688 char *yyptr = (char *) 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 /* 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