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