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