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