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