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