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