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