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