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