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