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