]> git.saurik.com Git - bison.git/blob - src/bison.simple
* src/reader.c (copy_action): When --yacc, don't append a `;'
[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 /* All symbols defined below should begin with yy or YY, to avoid
86 infringing on user name space. This should be done even for local
87 variables, as they might otherwise be expanded by user macros.
88 There are some unavoidable exceptions within include files to
89 define necessary library symbols; they are noted "INFRINGES ON
90 USER NAME SPACE" below. */
91
92 #if ! defined (yyoverflow) || YYERROR_VERBOSE
93
94 /* The parser invokes alloca or malloc; define the necessary symbols. */
95
96 # if YYSTACK_USE_ALLOCA
97 # define YYSTACK_ALLOC alloca
98 # define YYSIZE_T size_t
99 # else
100 # ifndef YYSTACK_USE_ALLOCA
101 # if defined (alloca) || defined (_ALLOCA_H)
102 # define YYSTACK_ALLOC alloca
103 # define YYSIZE_T size_t
104 # else
105 # if defined (__GNUC__) || defined (_AIX) || defined (__hpux)
106 # define YYSTACK_ALLOC __builtin_alloca
107 # endif
108 # ifndef __GNUC__
109 # ifdef _AIX
110 # pragma alloca
111 # endif
112 # if defined (__sgi) || defined (__sparc__) || defined (__sparc) || defined (__sun)
113 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
114 # define YYSTACK_ALLOC alloca
115 # define YYSIZE_T size_t
116 # endif
117 # endif
118 # endif
119 # endif
120 # endif
121
122 # ifdef YYSTACK_ALLOC
123 /* Pacify GCC's `empty if-body' warning. */
124 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
125 # else
126 # ifdef __cplusplus
127 # include <cstdlib> /* INFRINGES ON USER NAME SPACE */
128 # define YYSIZE_T std::size_t
129 # define YYSTACK_ALLOC std::malloc
130 # define YYSTACK_FREE std::free
131 # else
132 # ifdef __STDC__
133 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
134 # define YYSIZE_T size_t
135 # endif
136 # define YYSTACK_ALLOC malloc
137 # define YYSTACK_FREE free
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)
293 # ifdef __cplusplus
294 # include <cstddef> /* INFRINGES ON USER NAME SPACE */
295 # define YYSIZE_T std::size_t
296 # else
297 # ifdef __STDC__
298 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
299 # define YYSIZE_T size_t
300 # endif
301 # endif
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
380 # ifndef YYFPRINTF
381 # ifdef __cplusplus
382 # include <cstdio.h> /* INFRINGES ON USER NAME SPACE */
383 # define YYFPRINTF std::fprintf
384 # define YYSTDERR std::stderr
385 # else
386 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
387 # define YYFPRINTF fprintf
388 # define YYSTDERR stderr
389 # endif
390 # endif
391
392 # define YYDPRINTF(Args) \
393 do { \
394 if (yydebug) \
395 YYFPRINTF Args; \
396 } while (0)
397 /* Nonzero means print parse trace. [The following comment makes no
398 sense to me. Could someone clarify it? --akim] Since this is
399 uninitialized, it does not stop multiple parsers from coexisting.
400 */
401 int yydebug;
402 #else /* !YYDEBUG */
403 # define YYDPRINTF(Args)
404 #endif /* !YYDEBUG */
405
406 /* YYINITDEPTH -- initial size of the parser's stacks. */
407 #ifndef YYINITDEPTH
408 # define YYINITDEPTH %%initdepth
409 #endif
410
411 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
412 if the built-in stack extension method is used).
413
414 Do not make this value too large; the results are undefined if
415 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
416 evaluated with infinite-precision integer arithmetic. */
417
418 #if YYMAXDEPTH == 0
419 # undef YYMAXDEPTH
420 #endif
421
422 #ifndef YYMAXDEPTH
423 # define YYMAXDEPTH %%maxdepth
424 #endif
425
426 \f
427
428 #if ! defined (yyoverflow) && ! defined (yymemcpy)
429 # if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
430 # define yymemcpy __builtin_memcpy
431 # else /* not GNU C or C++ */
432
433 /* This is the most reliable way to avoid incompatibilities
434 in available built-in functions on various systems. */
435 static void
436 # if defined (__STDC__) || defined (__cplusplus)
437 yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
438 # else
439 yymemcpy (yyto, yyfrom, yycount)
440 char *yyto;
441 const char *yyfrom;
442 YYSIZE_T yycount;
443 # endif
444 {
445 register const char *yyf = yyfrom;
446 register char *yyt = yyto;
447 register YYSIZE_T yyi = yycount;
448
449 while (yyi-- != 0)
450 *yyt++ = *yyf++;
451 }
452 # endif
453 #endif
454
455 #if YYERROR_VERBOSE
456
457 # ifndef yystrlen
458 # if defined (__GLIBC__) && defined (_STRING_H)
459 # define yystrlen strlen
460 # else
461 /* Return the length of YYSTR. */
462 static YYSIZE_T
463 # if defined (__STDC__) || defined (__cplusplus)
464 yystrlen (const char *yystr)
465 # else
466 yystrlen (yystr)
467 const char *yystr;
468 # endif
469 {
470 register const char *yys = yystr;
471
472 while (*yys++ != '\0')
473 continue;
474
475 return yys - yystr - 1;
476 }
477 # endif
478 # endif
479
480 # ifndef yystpcpy
481 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
482 # define yystpcpy stpcpy
483 # else
484 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
485 YYDEST. */
486 static char *
487 # if defined (__STDC__) || defined (__cplusplus)
488 yystpcpy (char *yydest, const char *yysrc)
489 # else
490 yystpcpy (yydest, yysrc)
491 char *yydest;
492 const char *yysrc;
493 # endif
494 {
495 register char *yyd = yydest;
496 register const char *yys = yysrc;
497
498 while ((*yyd++ = *yys++) != '\0')
499 continue;
500
501 return yyd - 1;
502 }
503 # endif
504 # endif
505
506 #endif /* !YYERROR_VERBOSE */
507
508 \f
509
510 #line %%line "%%skeleton"
511
512 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
513 into yyparse. The argument should have type void *.
514 It should actually point to an object.
515 Grammar actions can access the variable by casting it
516 to the proper pointer type. */
517
518 #ifdef YYPARSE_PARAM
519 # ifdef __cplusplus
520 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
521 # define YYPARSE_PARAM_DECL
522 # else /* !__cplusplus */
523 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
524 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
525 # endif /* !__cplusplus */
526 #else /* !YYPARSE_PARAM */
527 # define YYPARSE_PARAM_ARG
528 # define YYPARSE_PARAM_DECL
529 #endif /* !YYPARSE_PARAM */
530
531 /* Prevent warning if -Wstrict-prototypes. */
532 #ifdef __GNUC__
533 # ifdef YYPARSE_PARAM
534 int yyparse (void *);
535 # else
536 int yyparse (void);
537 # endif
538 #endif
539
540 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
541 variables are global, or local to YYPARSE. */
542
543 #define YY_DECL_NON_LSP_VARIABLES \
544 /* The lookahead symbol. */ \
545 int yychar; \
546 \
547 /* The semantic value of the lookahead symbol. */ \
548 YYSTYPE yylval; \
549 \
550 /* Number of parse errors so far. */ \
551 int yynerrs;
552
553 #if YYLSP_NEEDED
554 # define YY_DECL_VARIABLES \
555 YY_DECL_NON_LSP_VARIABLES \
556 \
557 /* Location data for the lookahead symbol. */ \
558 YYLTYPE yylloc;
559 #else
560 # define YY_DECL_VARIABLES \
561 YY_DECL_NON_LSP_VARIABLES
562 #endif
563
564 /* If nonreentrant, generate the variables here. */
565
566 #if !YYPURE
567 YY_DECL_VARIABLES
568 #endif /* !YYPURE */
569
570 int
571 yyparse (YYPARSE_PARAM_ARG)
572 YYPARSE_PARAM_DECL
573 {
574 /* If reentrant, generate the variables here. */
575 #if YYPURE
576 YY_DECL_VARIABLES
577 #endif /* !YYPURE */
578
579 register int yystate;
580 register int yyn;
581 int yyresult;
582 /* Number of tokens to shift before error messages enabled. */
583 int yyerrstatus;
584 /* Lookahead token as an internal (translated) token number. */
585 int yychar1 = 0;
586
587 /* Three stacks and their tools:
588 `yyss': related to states,
589 `yyvs': related to semantic values,
590 `yyls': related to locations.
591
592 Refer to the stacks thru separate pointers, to allow yyoverflow
593 to reallocate them elsewhere. */
594
595 /* The state stack. */
596 short yyssa[YYINITDEPTH];
597 short *yyss = yyssa;
598 register short *yyssp;
599
600 /* The semantic value stack. */
601 YYSTYPE yyvsa[YYINITDEPTH];
602 YYSTYPE *yyvs = yyvsa;
603 register YYSTYPE *yyvsp;
604
605 #if YYLSP_NEEDED
606 /* The location stack. */
607 YYLTYPE yylsa[YYINITDEPTH];
608 YYLTYPE *yyls = yylsa;
609 YYLTYPE *yylsp;
610 #endif
611
612 #if YYLSP_NEEDED
613 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
614 #else
615 # define YYPOPSTACK (yyvsp--, yyssp--)
616 #endif
617
618 YYSIZE_T yystacksize = YYINITDEPTH;
619
620 /* The variables used to return semantic value and location from the
621 action routines. */
622 YYSTYPE yyval;
623 #if YYLSP_NEEDED
624 YYLTYPE yyloc;
625 #endif
626
627 /* When reducing, the number of symbols on the RHS of the reduced
628 rule. */
629 int yylen;
630
631 YYDPRINTF ((YYSTDERR, "Starting parse\n"));
632
633 yystate = 0;
634 yyerrstatus = 0;
635 yynerrs = 0;
636 yychar = YYEMPTY; /* Cause a token to be read. */
637
638 /* Initialize stack pointers.
639 Waste one element of value and location stack
640 so that they stay on the same level as the state stack.
641 The wasted elements are never initialized. */
642
643 yyssp = yyss;
644 yyvsp = yyvs;
645 #if YYLSP_NEEDED
646 yylsp = yyls;
647 #endif
648 goto yysetstate;
649
650 /*------------------------------------------------------------.
651 | yynewstate -- Push a new state, which is found in yystate. |
652 `------------------------------------------------------------*/
653 yynewstate:
654 /* In all cases, when you get here, the value and location stacks
655 have just been pushed. so pushing a state here evens the stacks.
656 */
657 yyssp++;
658
659 yysetstate:
660 *yyssp = yystate;
661
662 if (yyssp >= yyss + yystacksize - 1)
663 {
664 /* Get the current used size of the three stacks, in elements. */
665 YYSIZE_T yysize = yyssp - yyss + 1;
666
667 #ifdef yyoverflow
668 {
669 /* Give user a chance to reallocate the stack. Use copies of
670 these so that the &'s don't force the real ones into
671 memory. */
672 YYSTYPE *yyvs1 = yyvs;
673 short *yyss1 = yyss;
674
675 /* Each stack pointer address is followed by the size of the
676 data in use in that stack, in bytes. */
677 # if YYLSP_NEEDED
678 YYLTYPE *yyls1 = yyls;
679 /* This used to be a conditional around just the two extra args,
680 but that might be undefined if yyoverflow is a macro. */
681 yyoverflow ("parser stack overflow",
682 &yyss1, yysize * sizeof (*yyssp),
683 &yyvs1, yysize * sizeof (*yyvsp),
684 &yyls1, yysize * sizeof (*yylsp),
685 &yystacksize);
686 yyls = yyls1;
687 # else
688 yyoverflow ("parser stack overflow",
689 &yyss1, yysize * sizeof (*yyssp),
690 &yyvs1, yysize * sizeof (*yyvsp),
691 &yystacksize);
692 # endif
693 yyss = yyss1;
694 yyvs = yyvs1;
695 }
696 #else /* no yyoverflow */
697 /* Extend the stack our own way. */
698 if (yystacksize >= YYMAXDEPTH)
699 goto yyoverflowlab;
700 yystacksize *= 2;
701 if (yystacksize > YYMAXDEPTH)
702 yystacksize = YYMAXDEPTH;
703
704 {
705 short *yyss1 = yyss;
706 union yyalloc *yyptr =
707 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
708 if (! yyptr)
709 goto yyoverflowlab;
710 YYSTACK_RELOCATE (short, yyss);
711 YYSTACK_RELOCATE (YYSTYPE, yyvs);
712 # if YYLSP_NEEDED
713 YYSTACK_RELOCATE (YYLTYPE, yyls);
714 # endif
715 # undef YYSTACK_RELOCATE
716 if (yyss1 != yyssa)
717 YYSTACK_FREE (yyss1);
718 }
719 #endif /* no yyoverflow */
720
721 yyssp = yyss + yysize - 1;
722 yyvsp = yyvs + yysize - 1;
723 #if YYLSP_NEEDED
724 yylsp = yyls + yysize - 1;
725 #endif
726
727 YYDPRINTF ((YYSTDERR, "Stack size increased to %lu\n",
728 (unsigned long int) yystacksize));
729
730 if (yyssp >= yyss + yystacksize - 1)
731 YYABORT;
732 }
733
734 YYDPRINTF ((YYSTDERR, "Entering state %d\n", yystate));
735
736 goto yybackup;
737
738 /*-----------.
739 | yybackup. |
740 `-----------*/
741 yybackup:
742
743 /* Do appropriate processing given the current state. */
744 /* Read a lookahead token if we need one and don't already have one. */
745 /* yyresume: */
746
747 /* First try to decide what to do without reference to lookahead token. */
748
749 yyn = yypact[yystate];
750 if (yyn == YYFLAG)
751 goto yydefault;
752
753 /* Not known => get a lookahead token if don't already have one. */
754
755 /* yychar is either YYEMPTY or YYEOF
756 or a valid token in external form. */
757
758 if (yychar == YYEMPTY)
759 {
760 YYDPRINTF ((YYSTDERR, "Reading a token: "));
761 yychar = YYLEX;
762 }
763
764 /* Convert token to internal form (in yychar1) for indexing tables with. */
765
766 if (yychar <= 0) /* This means end of input. */
767 {
768 yychar1 = 0;
769 yychar = YYEOF; /* Don't call YYLEX any more. */
770
771 YYDPRINTF ((YYSTDERR, "Now at end of input.\n"));
772 }
773 else
774 {
775 yychar1 = YYTRANSLATE (yychar);
776
777 #if YYDEBUG
778 /* We have to keep this `#if YYDEBUG', since we use variables
779 which are defined only if `YYDEBUG' is set. */
780 if (yydebug)
781 {
782 YYFPRINTF (YYSTDERR, "Next token is %d (%s",
783 yychar, yytname[yychar1]);
784 /* Give the individual parser a way to print the precise
785 meaning of a token, for further debugging info. */
786 # ifdef YYPRINT
787 YYPRINT (YYSTDERR, yychar, yylval);
788 # endif
789 YYFPRINTF (YYSTDERR, ")\n");
790 }
791 #endif
792 }
793
794 yyn += yychar1;
795 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
796 goto yydefault;
797
798 yyn = yytable[yyn];
799
800 /* yyn is what to do for this token type in this state.
801 Negative => reduce, -yyn is rule number.
802 Positive => shift, yyn is new state.
803 New state is final state => don't bother to shift,
804 just return success.
805 0, or most negative number => error. */
806
807 if (yyn < 0)
808 {
809 if (yyn == YYFLAG)
810 goto yyerrlab;
811 yyn = -yyn;
812 goto yyreduce;
813 }
814 else if (yyn == 0)
815 goto yyerrlab;
816
817 if (yyn == YYFINAL)
818 YYACCEPT;
819
820 /* Shift the lookahead token. */
821 YYDPRINTF ((YYSTDERR, "Shifting token %d (%s), ",
822 yychar, yytname[yychar1]));
823
824 /* Discard the token being shifted unless it is eof. */
825 if (yychar != YYEOF)
826 yychar = YYEMPTY;
827
828 *++yyvsp = yylval;
829 #if YYLSP_NEEDED
830 *++yylsp = yylloc;
831 #endif
832
833 /* Count tokens shifted since error; after three, turn off error
834 status. */
835 if (yyerrstatus)
836 yyerrstatus--;
837
838 yystate = yyn;
839 goto yynewstate;
840
841
842 /*-----------------------------------------------------------.
843 | yydefault -- do the default action for the current state. |
844 `-----------------------------------------------------------*/
845 yydefault:
846 yyn = yydefact[yystate];
847 if (yyn == 0)
848 goto yyerrlab;
849 goto yyreduce;
850
851
852 /*-----------------------------.
853 | yyreduce -- Do a reduction. |
854 `-----------------------------*/
855 yyreduce:
856 /* yyn is the number of a rule to reduce with. */
857 yylen = yyr2[yyn];
858
859 /* If YYLEN is nonzero, implement the default value of the action:
860 `$$ = $1'.
861
862 Otherwise, the following line sets YYVAL to the semantic value of
863 the lookahead token. This behavior is undocumented and Bison
864 users should not rely upon it. Assigning to YYVAL
865 unconditionally makes the parser a bit smaller, and it avoids a
866 GCC warning that YYVAL may be used uninitialized. */
867 yyval = yyvsp[1-yylen];
868
869 #if YYLSP_NEEDED
870 /* Similarly for the default location. Let the user run additional
871 commands if for instance locations are ranges. */
872 yyloc = yylsp[1-yylen];
873 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
874 #endif
875
876 #if YYDEBUG
877 /* We have to keep this `#if YYDEBUG', since we use variables which
878 are defined only if `YYDEBUG' is set. */
879 if (yydebug)
880 {
881 int yyi;
882
883 YYFPRINTF (YYSTDERR, "Reducing via rule %d (line %d), ",
884 yyn, yyrline[yyn]);
885
886 /* Print the symbols being reduced, and their result. */
887 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
888 YYFPRINTF (YYSTDERR, "%s ", yytname[yyrhs[yyi]]);
889 YYFPRINTF (YYSTDERR, " -> %s\n", yytname[yyr1[yyn]]);
890 }
891 #endif
892 switch (yyn)
893 {
894 %%action
895 }
896 #line %%line "%%skeleton"
897 \f
898 yyvsp -= yylen;
899 yyssp -= yylen;
900 #if YYLSP_NEEDED
901 yylsp -= yylen;
902 #endif
903
904 #if YYDEBUG
905 if (yydebug)
906 {
907 short *yyssp1 = yyss - 1;
908 YYFPRINTF (YYSTDERR, "state stack now");
909 while (yyssp1 != yyssp)
910 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
911 YYFPRINTF (YYSTDERR, "\n");
912 }
913 #endif
914
915 *++yyvsp = yyval;
916 #if YYLSP_NEEDED
917 *++yylsp = yyloc;
918 #endif
919
920 /* Now `shift' the result of the reduction. Determine what state
921 that goes to, based on the state we popped back to and the rule
922 number reduced by. */
923
924 yyn = yyr1[yyn];
925
926 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
927 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
928 yystate = yytable[yystate];
929 else
930 yystate = yydefgoto[yyn - YYNTBASE];
931
932 goto yynewstate;
933
934
935 /*------------------------------------.
936 | yyerrlab -- here on detecting error |
937 `------------------------------------*/
938 yyerrlab:
939 /* If not already recovering from an error, report this error. */
940 if (!yyerrstatus)
941 {
942 ++yynerrs;
943
944 #if YYERROR_VERBOSE
945 yyn = yypact[yystate];
946
947 if (yyn > YYFLAG && yyn < YYLAST)
948 {
949 YYSIZE_T yysize = 0;
950 char *yymsg;
951 int yyx, yycount;
952
953 yycount = 0;
954 /* Start YYX at -YYN if negative to avoid negative indexes in
955 YYCHECK. */
956 for (yyx = yyn < 0 ? -yyn : 0;
957 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
958 if (yycheck[yyx + yyn] == yyx)
959 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
960 yysize += yystrlen ("parse error, unexpected ") + 1;
961 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
962 yymsg = (char *) YYSTACK_ALLOC (yysize);
963 if (yymsg != 0)
964 {
965 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
966 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
967
968 if (yycount < 5)
969 {
970 yycount = 0;
971 for (yyx = yyn < 0 ? -yyn : 0;
972 yyx < (int) (sizeof (yytname) / sizeof (char *));
973 yyx++)
974 if (yycheck[yyx + yyn] == yyx)
975 {
976 const char *yyq = ! yycount ? ", expecting " : " or ";
977 yyp = yystpcpy (yyp, yyq);
978 yyp = yystpcpy (yyp, yytname[yyx]);
979 yycount++;
980 }
981 }
982 yyerror (yymsg);
983 YYSTACK_FREE (yymsg);
984 }
985 else
986 yyerror ("parse error; also virtual memory exhausted");
987 }
988 else
989 #endif /* YYERROR_VERBOSE */
990 yyerror ("parse error");
991 }
992 goto yyerrlab1;
993
994
995 /*----------------------------------------------------.
996 | yyerrlab1 -- error raised explicitly by an action. |
997 `----------------------------------------------------*/
998 yyerrlab1:
999 if (yyerrstatus == 3)
1000 {
1001 /* If just tried and failed to reuse lookahead token after an
1002 error, discard it. */
1003
1004 /* Return failure if at end of input. */
1005 if (yychar == YYEOF)
1006 YYABORT;
1007 YYDPRINTF ((YYSTDERR, "Discarding token %d (%s).\n",
1008 yychar, yytname[yychar1]));
1009 yychar = YYEMPTY;
1010 }
1011
1012 /* Else will try to reuse lookahead token after shifting the error
1013 token. */
1014
1015 yyerrstatus = 3; /* Each real token shifted decrements this. */
1016
1017 goto yyerrhandle;
1018
1019
1020 /*-------------------------------------------------------------------.
1021 | yyerrdefault -- current state does not do anything special for the |
1022 | error token. |
1023 `-------------------------------------------------------------------*/
1024 yyerrdefault:
1025 #if 0
1026 /* This is wrong; only states that explicitly want error tokens
1027 should shift them. */
1028
1029 /* If its default is to accept any token, ok. Otherwise pop it. */
1030 yyn = yydefact[yystate];
1031 if (yyn)
1032 goto yydefault;
1033 #endif
1034
1035
1036 /*---------------------------------------------------------------.
1037 | yyerrpop -- pop the current state because it cannot handle the |
1038 | error token. |
1039 `---------------------------------------------------------------*/
1040 yyerrpop:
1041 if (yyssp == yyss)
1042 YYABORT;
1043 yyvsp--;
1044 yystate = *--yyssp;
1045 #if YYLSP_NEEDED
1046 yylsp--;
1047 #endif
1048
1049 #if YYDEBUG
1050 if (yydebug)
1051 {
1052 short *yyssp1 = yyss - 1;
1053 YYFPRINTF (YYSTDERR, "Error: state stack now");
1054 while (yyssp1 != yyssp)
1055 YYFPRINTF (YYSTDERR, " %d", *++yyssp1);
1056 YYFPRINTF (YYSTDERR, "\n");
1057 }
1058 #endif
1059
1060 /*--------------.
1061 | yyerrhandle. |
1062 `--------------*/
1063 yyerrhandle:
1064 yyn = yypact[yystate];
1065 if (yyn == YYFLAG)
1066 goto yyerrdefault;
1067
1068 yyn += YYTERROR;
1069 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1070 goto yyerrdefault;
1071
1072 yyn = yytable[yyn];
1073 if (yyn < 0)
1074 {
1075 if (yyn == YYFLAG)
1076 goto yyerrpop;
1077 yyn = -yyn;
1078 goto yyreduce;
1079 }
1080 else if (yyn == 0)
1081 goto yyerrpop;
1082
1083 if (yyn == YYFINAL)
1084 YYACCEPT;
1085
1086 YYDPRINTF ((YYSTDERR, "Shifting error token, "));
1087
1088 *++yyvsp = yylval;
1089 #if YYLSP_NEEDED
1090 *++yylsp = yylloc;
1091 #endif
1092
1093 yystate = yyn;
1094 goto yynewstate;
1095
1096
1097 /*-------------------------------------.
1098 | yyacceptlab -- YYACCEPT comes here. |
1099 `-------------------------------------*/
1100 yyacceptlab:
1101 yyresult = 0;
1102 goto yyreturn;
1103
1104 /*-----------------------------------.
1105 | yyabortlab -- YYABORT comes here. |
1106 `-----------------------------------*/
1107 yyabortlab:
1108 yyresult = 1;
1109 goto yyreturn;
1110
1111 /*---------------------------------------------.
1112 | yyoverflowab -- parser overflow comes here. |
1113 `---------------------------------------------*/
1114 yyoverflowlab:
1115 yyerror ("parser stack overflow");
1116 yyresult = 2;
1117 /* Fall through. */
1118
1119 yyreturn:
1120 #ifndef yyoverflow
1121 if (yyss != yyssa)
1122 YYSTACK_FREE (yyss);
1123 #endif
1124 return yyresult;
1125 }
1126
1127 %%epilogue