1 m4_divert(-1) -*- C -*-
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],
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],
21 # b4_lhs_value([TYPE])
22 # --------------------
23 # Expansion of $<TYPE>$.
24 m4_define([b4_lhs_value],
25 [yyval[]m4_ifval([$1], [.$1])])
28 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
29 # --------------------------------------
30 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
32 m4_define([b4_rhs_value],
33 [yyvsp@<:@m4_eval([$2 - $1])@:>@m4_ifval([$3], [.$3])])
41 # b4_location_if(IF-TRUE, IF-FALSE)
42 # ---------------------------------
43 # Expand IF-TRUE, if locations are used, IF-FALSE otherwise.
44 m4_define([b4_location_if],
45 [m4_if(b4_locations_flag, [1],
53 m4_define([b4_lhs_location],
57 # b4_rhs_location(RULE-LENGTH, NUM)
58 # ---------------------------------
59 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
61 m4_define([b4_rhs_location],
62 [yylsp@<:@m4_eval([$2 - $1])@:>@])
70 # b4_pure_if(IF-TRUE, IF-FALSE)
71 # -----------------------------
72 # Expand IF-TRUE, if %pure-parser, IF-FALSE otherwise.
73 m4_define([b4_pure_if],
79 ## ------------------- ##
80 ## Output file names. ##
81 ## ------------------- ##
83 m4_define_default([b4_input_suffix], [.y])
85 m4_define_default([b4_output_parser_suffix],
86 [m4_translit(b4_input_suffix, [yY], [cC])])
88 m4_define_default([b4_output_parser_name],
89 [b4_output_prefix[]b4_output_infix[]b4_output_parser_suffix[]])
92 m4_define_default([b4_output_header_suffix],
93 [m4_translit(b4_input_suffix, [yY], [hH])])
95 m4_define_default([b4_output_header_name],
96 [b4_output_prefix[]b4_output_infix[]b4_output_header_suffix[]])
98 m4_define_default([b4_header_guard],
99 [m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name),
100 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])])
103 ## ------------------------- ##
104 ## Assigning token numbers. ##
105 ## ------------------------- ##
107 # b4_token_define(TOKEN-NAME, TOKEN-NUMBER)
108 # -----------------------------------------
109 # Output the definition of this token as #define.
110 m4_define([b4_token_define],
115 # b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
116 # ---------------------------------------
117 # Output the definition of this token as an enum.
118 m4_define([b4_token_enum],
122 # b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
123 # -------------------------------------------------------
124 # Output the definition of the tokens (if there are) as enums and #define.
125 m4_define([b4_token_defines],
126 [m4_if([$@], [[]], [],
129 # if defined (__STDC__) || defined (__cplusplus)
130 /* Put the tokens into the symbol table, so that GDB and other debuggers
133 m4_map_sep([ b4_token_enum], [,
138 /* POSIX requires `int' for tokens in interfaces. */
139 # define YYTOKENTYPE int
140 #endif /* !YYTOKENTYPE */
141 m4_map([b4_token_define], [$@])
147 #output "b4_output_parser_name"
148 /* A Bison parser, made from b4_filename
149 by GNU bison b4_version. */
151 /* Skeleton output parser for Bison,
152 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
155 This program is free software; you can redistribute it and/or modify
156 it under the terms of the GNU General Public License as published by
157 the Free Software Foundation; either version 2, or (at your option)
160 This program is distributed in the hope that it will be useful,
161 but WITHOUT ANY WARRANTY; without even the implied warranty of
162 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
163 GNU General Public License for more details.
165 You should have received a copy of the GNU General Public License
166 along with this program; if not, write to the Free Software
167 Foundation, Inc., 59 Temple Place - Suite 330,
168 Boston, MA 02111-1307, USA. */
170 /* As a special exception, when this file is copied by Bison into a
171 Bison output file, you may use that output file without restriction.
172 This special exception was added by the Free Software Foundation
173 in version 1.24 of Bison. */
175 /* This is the parser code that is written into each bison parser when
176 the %semantic_parser declaration is not specified in the grammar.
177 It was written by Richard Stallman by simplifying the original so
178 called ``semantic'' parser. */
180 /* All symbols defined below should begin with yy or YY, to avoid
181 infringing on user name space. This should be done even for local
182 variables, as they might otherwise be expanded by user macros.
183 There are some unavoidable exceptions within include files to
184 define necessary library symbols; they are noted "INFRINGES ON
185 USER NAME SPACE" below. */
187 /* Identify Bison output. */
191 #define YYPURE b4_pure
193 /* Using locations. */
194 #define YYLSP_NEEDED b4_locations_flag
196 m4_if(b4_prefix[], [yy], [],
197 [/* If NAME_PREFIX is specified substitute the variables and functions
199 #define yyparse b4_prefix[]parse
200 #define yylex b4_prefix[]lex
201 #define yyerror b4_prefix[]error
202 #define yylval b4_prefix[]lval
203 #define yychar b4_prefix[]char
204 #define yydebug b4_prefix[]debug
205 #define yynerrs b4_prefix[]nerrs
206 b4_location_if([#define yylloc b4_prefix[]lloc])])
208 /* Copy the first part of user declarations. */
211 b4_token_defines(b4_tokens)
213 /* Enabling traces. */
215 # define YYDEBUG b4_debug
218 /* Enabling verbose error messages. */
219 #ifdef YYERROR_VERBOSE
220 # undef YYERROR_VERBOSE
221 # define YYERROR_VERBOSE 1
223 # define YYERROR_VERBOSE b4_error_verbose
228 [#line b4_stype_line "b4_filename"
229 typedef union b4_stype yystype;
230 /* Line __line__ of __file__. */
231 #line __oline__ "__ofile__"],
232 [typedef int yystype;])
233 # define YYSTYPE yystype
234 # define YYSTYPE_IS_TRIVIAL 1
238 typedef struct yyltype
245 # define YYLTYPE b4_ltype
246 # define YYLTYPE_IS_TRIVIAL 1
249 /* Copy the second part of user declarations. */
252 /* Line __line__ of __file__. */
253 #line __oline__ "__ofile__"
255 #if ! defined (yyoverflow) || YYERROR_VERBOSE
257 /* The parser invokes alloca or malloc; define the necessary symbols. */
259 # if YYSTACK_USE_ALLOCA
260 # define YYSTACK_ALLOC alloca
262 # ifndef YYSTACK_USE_ALLOCA
263 # if defined (alloca) || defined (_ALLOCA_H)
264 # define YYSTACK_ALLOC alloca
267 # define YYSTACK_ALLOC __builtin_alloca
273 # ifdef YYSTACK_ALLOC
274 /* Pacify GCC's `empty if-body' warning. */
275 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
277 # if defined (__STDC__) || defined (__cplusplus)
278 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
279 # define YYSIZE_T size_t
281 # define YYSTACK_ALLOC malloc
282 # define YYSTACK_FREE free
284 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
287 #if (! defined (yyoverflow) \
288 && (! defined (__cplusplus) \
289 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
291 /* A type that is properly aligned for any stack member. */
296 b4_location_if([ YYLTYPE yyls;
300 /* The size of the maximum gap between one aligned stack and the next. */
301 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
303 /* The size of an array large to enough to hold all stacks, each with
306 [# define YYSTACK_BYTES(N) \
307 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
308 + 2 * YYSTACK_GAP_MAX)],
309 [# define YYSTACK_BYTES(N) \
310 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
313 /* Copy COUNT objects from FROM to TO. The source and destination do
317 # define YYCOPY(To, From, Count) \
318 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
320 # define YYCOPY(To, From, Count) \
323 register YYSIZE_T yyi; \
324 for (yyi = 0; yyi < (Count); yyi++) \
325 (To)[[yyi]] = (From)[[yyi]]; \
331 /* Relocate STACK from its old location to the new one. The
332 local variables YYSIZE and YYSTACKSIZE give the old and new number of
333 elements in the stack, and YYPTR gives the new location of the
334 stack. Advance YYPTR to a properly aligned location for the next
336 # define YYSTACK_RELOCATE(Stack) \
339 YYSIZE_T yynewbytes; \
340 YYCOPY (&yyptr->Stack, Stack, yysize); \
341 Stack = &yyptr->Stack; \
342 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
343 yyptr += yynewbytes / sizeof (*yyptr); \
349 /* YYFINAL -- State number of the termination state. */
350 #define YYFINAL b4_final
351 #define YYFLAG b4_flag
352 #define YYLAST b4_last
354 /* YYNTOKENS -- Number of terminals. */
355 #define YYNTOKENS b4_ntokens
356 /* YYNNTS -- Number of nonterminals. */
357 #define YYNNTS b4_nnts
358 /* YYNRULES -- Number of rules. */
359 #define YYNRULES b4_nrules
360 /* YYNRULES -- Number of states. */
361 #define YYNSTATES b4_nstates
363 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
364 #define YYUNDEFTOK b4_undef_token_number
365 #define YYMAXUTOK b4_user_token_number_max
367 #define YYTRANSLATE(X) \
368 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
370 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
371 static const b4_uint_type(b4_translate_max) yytranslate[[]] =
377 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
379 static const b4_uint_type(b4_prhs_max) yyprhs[[]] =
384 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
385 static const b4_sint_type(b4_rhs_max) yyrhs[[]] =
390 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
391 static const b4_uint_type(b4_rline_max) yyrline[[]] =
397 #if YYDEBUG || YYERROR_VERBOSE
398 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
399 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
400 static const char *const yytname[[]] =
406 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
408 static const short yytoknum[[]] =
413 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
414 static const b4_uint_type(b4_r1_max) yyr1[[]] =
419 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
420 static const b4_uint_type(b4_r2_max) yyr2[[]] =
425 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
426 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
427 means the default is an error. */
428 static const short yydefact[[]] =
433 /* YYPGOTO[[NTERM-NUM]]. */
434 static const short yydefgoto[[]] =
439 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
441 static const short yypact[[]] =
446 /* YYPGOTO[[NTERM-NUM]]. */
447 static const short yypgoto[[]] =
452 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
453 positive, shift that token. If negative, reduce the rule which
454 number is the opposite. If zero, do what YYDEFACT says. */
455 static const short yytable[[]] =
460 static const short yycheck[[]] =
465 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
466 symbol of state STATE-NUM. */
467 static const b4_uint_type(b4_stos_max) yystos[[]] =
472 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
473 # define YYSIZE_T __SIZE_TYPE__
475 #if ! defined (YYSIZE_T) && defined (size_t)
476 # define YYSIZE_T size_t
478 #if ! defined (YYSIZE_T)
479 # if defined (__STDC__) || defined (__cplusplus)
480 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
481 # define YYSIZE_T size_t
484 #if ! defined (YYSIZE_T)
485 # define YYSIZE_T unsigned int
488 #define yyerrok (yyerrstatus = 0)
489 #define yyclearin (yychar = YYEMPTY)
493 #define YYACCEPT goto yyacceptlab
494 #define YYABORT goto yyabortlab
495 #define YYERROR goto yyerrlab1
497 /* Like YYERROR except do call yyerror. This remains here temporarily
498 to ease the transition to the new meaning of YYERROR, for GCC.
499 Once GCC version 2 has supplanted version 1, this can go. */
501 #define YYFAIL goto yyerrlab
503 #define YYRECOVERING() (!!yyerrstatus)
505 #define YYBACKUP(Token, Value) \
507 if (yychar == YYEMPTY && yylen == 1) \
511 yychar1 = YYTRANSLATE (yychar); \
517 yyerror ("syntax error: cannot back up"); \
523 #define YYERRCODE 256
525 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
528 #ifndef YYLLOC_DEFAULT
529 # define YYLLOC_DEFAULT(Current, Rhs, N) \
530 Current.first_line = Rhs[[1]].first_line; \
531 Current.first_column = Rhs[[1]].first_column; \
532 Current.last_line = Rhs[[N]].last_line; \
533 Current.last_column = Rhs[[N]].last_column;
536 /* YYLEX -- calling `yylex' with the right arguments. */
540 # define YYLEX yylex (&yylval, b4_location_if([&yylloc, ])YYLEX_PARAM)
542 # define YYLEX yylex (&yylval, b4_location_if([&yylloc, ]))
544 [#define YYLEX yylex ()])
546 /* Enable debugging if requested. */
550 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
551 # define YYFPRINTF fprintf
554 # define YYDPRINTF(Args) \
559 /* Nonzero means print parse trace. It is left uninitialized so that
560 multiple parsers can coexist. */
563 # define YYDPRINTF(Args)
564 #endif /* !YYDEBUG */
566 /* YYINITDEPTH -- initial size of the parser's stacks. */
568 # define YYINITDEPTH b4_initdepth
571 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
572 if the built-in stack extension method is used).
574 Do not make this value too large; the results are undefined if
575 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
576 evaluated with infinite-precision integer arithmetic. */
583 # define YYMAXDEPTH b4_maxdepth
591 # if defined (__GLIBC__) && defined (_STRING_H)
592 # define yystrlen strlen
594 /* Return the length of YYSTR. */
596 # if defined (__STDC__) || defined (__cplusplus)
597 yystrlen (const char *yystr)
603 register const char *yys = yystr;
605 while (*yys++ != '\0')
608 return yys - yystr - 1;
614 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
615 # define yystpcpy stpcpy
617 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
620 # if defined (__STDC__) || defined (__cplusplus)
621 yystpcpy (char *yydest, const char *yysrc)
623 yystpcpy (yydest, yysrc)
628 register char *yyd = yydest;
629 register const char *yys = yysrc;
631 while ((*yyd++ = *yys++) != '\0')
639 #endif /* !YYERROR_VERBOSE */
643 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
644 into yyparse. The argument should have type void *.
645 It should actually point to an object.
646 Grammar actions can access the variable by casting it
647 to the proper pointer type. */
650 # if defined (__STDC__) || defined (__cplusplus)
651 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
652 # define YYPARSE_PARAM_DECL
654 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
655 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
657 #else /* !YYPARSE_PARAM */
658 # define YYPARSE_PARAM_ARG
659 # define YYPARSE_PARAM_DECL
660 #endif /* !YYPARSE_PARAM */
662 /* Prevent warning if -Wstrict-prototypes. */
664 # ifdef YYPARSE_PARAM
665 int yyparse (void *);
671 #if defined (__STDC__) || defined (__cplusplus)
672 static void yydestructor (int yytype,
673 YYSTYPE yyvalue[]b4_location_if([, YYLTYPE yylocation]));
675 static void yysymprint (FILE* out, int yytype,
676 YYSTYPE yyvalue[]b4_location_if([, YYLTYPE yylocation]));
680 m4_divert_push([KILL])# ======================== M4 code.
681 # b4_declare_parser_variables
682 # ---------------------------
683 # Declare the variables that are global, or local to YYPARSE if
685 m4_define([b4_declare_parser_variables],
686 [/* The lookahead symbol. */
689 /* The semantic value of the lookahead symbol. */
692 /* Number of parse errors so far. */
693 int yynerrs;b4_location_if([
694 /* Location data for the lookahead symbol. */
697 m4_divert_pop([KILL])dnl# ====================== End of M4 code.
700 [b4_declare_parser_variables])
703 yyparse (YYPARSE_PARAM_ARG)
706 ]b4_pure_if([b4_declare_parser_variables])[
707 register int yystate;
710 /* Number of tokens to shift before error messages enabled. */
712 /* Lookahead token as an internal (translated) token number. */
715 /* Three stacks and their tools:
716 `yyss': related to states,
717 `yyvs': related to semantic values,
718 `yyls': related to locations.
720 Refer to the stacks thru separate pointers, to allow yyoverflow
721 to reallocate them elsewhere. */
723 /* The state stack. */
724 short yyssa[YYINITDEPTH];
726 register short *yyssp;
728 /* The semantic value stack. */
729 YYSTYPE yyvsa[YYINITDEPTH];
730 YYSTYPE *yyvs = yyvsa;
731 register YYSTYPE *yyvsp;
734 [[ /* The location stack. */
735 YYLTYPE yylsa[YYINITDEPTH];
736 YYLTYPE *yyls = yylsa;
739 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
741 YYSIZE_T yystacksize = YYINITDEPTH;
743 /* The variables used to return semantic value and location from the
746 ]b4_location_if([ YYLTYPE yyloc;])[
748 /* When reducing, the number of symbols on the RHS of the reduced
752 YYDPRINTF ((stderr, "Starting parse\n"));
757 yychar = YYEMPTY; /* Cause a token to be read. */
759 /* Initialize stack pointers.
760 Waste one element of value and location stack
761 so that they stay on the same level as the state stack.
762 The wasted elements are never initialized. */
766 ]b4_location_if([ yylsp = yyls;])[
769 /*------------------------------------------------------------.
770 | yynewstate -- Push a new state, which is found in yystate. |
771 `------------------------------------------------------------*/
773 /* In all cases, when you get here, the value and location stacks
774 have just been pushed. so pushing a state here evens the stacks.
781 if (yyssp >= yyss + yystacksize - 1)
783 /* Get the current used size of the three stacks, in elements. */
784 YYSIZE_T yysize = yyssp - yyss + 1;
788 /* Give user a chance to reallocate the stack. Use copies of
789 these so that the &'s don't force the real ones into
791 YYSTYPE *yyvs1 = yyvs;
793 ]b4_location_if([ YYLTYPE *yyls1 = yyls;])[
795 /* Each stack pointer address is followed by the size of the
796 data in use in that stack, in bytes. This used to be a
797 conditional around just the two extra args, but that might
798 be undefined if yyoverflow is a macro. */
799 yyoverflow ("parser stack overflow",
800 &yyss1, yysize * sizeof (*yyssp),
801 &yyvs1, yysize * sizeof (*yyvsp),
802 ]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[
804 ]b4_location_if([ yyls = yyls1;])[
808 #else /* no yyoverflow */
809 # ifndef YYSTACK_RELOCATE
812 /* Extend the stack our own way. */
813 if (yystacksize >= YYMAXDEPTH)
816 if (yystacksize > YYMAXDEPTH)
817 yystacksize = YYMAXDEPTH;
821 union yyalloc *yyptr =
822 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
825 YYSTACK_RELOCATE (yyss);
826 YYSTACK_RELOCATE (yyvs);
827 ]b4_location_if([ YYSTACK_RELOCATE (yyls);])[
828 # undef YYSTACK_RELOCATE
830 YYSTACK_FREE (yyss1);
833 #endif /* no yyoverflow */
835 yyssp = yyss + yysize - 1;
836 yyvsp = yyvs + yysize - 1;
837 ]b4_location_if([ yylsp = yyls + yysize - 1;])[
839 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
840 (unsigned long int) yystacksize));
842 if (yyssp >= yyss + yystacksize - 1)
846 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
855 /* Do appropriate processing given the current state. */
856 /* Read a lookahead token if we need one and don't already have one. */
859 /* First try to decide what to do without reference to lookahead token. */
861 yyn = yypact[yystate];
865 /* Not known => get a lookahead token if don't already have one. */
867 /* yychar is either YYEMPTY or YYEOF
868 or a valid token in external form. */
870 if (yychar == YYEMPTY)
872 YYDPRINTF ((stderr, "Reading a token: "));
876 /* Convert token to internal form (in yychar1) for indexing tables with. */
878 if (yychar <= 0) /* This means end of input. */
881 yychar = YYEOF; /* Don't call YYLEX any more. */
883 YYDPRINTF ((stderr, "Now at end of input.\n"));
887 yychar1 = YYTRANSLATE (yychar);
890 /* We have to keep this `#if YYDEBUG', since we use variables
891 which are defined only if `YYDEBUG' is set. */
894 YYFPRINTF (stderr, "Next token is ");
895 yysymprint (stderr, yychar1, yylval]b4_location_if([, yyloc])[);
896 YYFPRINTF (stderr, "\n");
902 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
907 /* yyn is what to do for this token type in this state.
908 Negative => reduce, -yyn is rule number.
909 Positive => shift, yyn is new state.
910 New state is final state => don't bother to shift,
912 0, or most negative number => error. */
927 /* Shift the lookahead token. */
928 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
929 yychar, yytname[yychar1]));
931 /* Discard the token being shifted unless it is eof. */
936 ]b4_location_if([ *++yylsp = yylloc;])[
938 /* Count tokens shifted since error; after three, turn off error
947 /*-----------------------------------------------------------.
948 | yydefault -- do the default action for the current state. |
949 `-----------------------------------------------------------*/
951 yyn = yydefact[yystate];
957 /*-----------------------------.
958 | yyreduce -- Do a reduction. |
959 `-----------------------------*/
961 /* yyn is the number of a rule to reduce with. */
964 /* If YYLEN is nonzero, implement the default value of the action:
967 Otherwise, the following line sets YYVAL to the semantic value of
968 the lookahead token. This behavior is undocumented and Bison
969 users should not rely upon it. Assigning to YYVAL
970 unconditionally makes the parser a bit smaller, and it avoids a
971 GCC warning that YYVAL may be used uninitialized. */
972 yyval = yyvsp[1-yylen];
975 [ /* Default location. */
976 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);])[
979 /* We have to keep this `#if YYDEBUG', since we use variables which
980 are defined only if `YYDEBUG' is set. */
985 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
986 yyn - 1, yyrline[yyn]);
988 /* Print the symbols being reduced, and their result. */
989 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
990 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
991 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
999 /* Line __line__ of __file__. */
1000 #line __oline__ "__ofile__"
1004 ]b4_location_if([ yylsp -= yylen;])[
1009 short *yyssp1 = yyss - 1;
1010 YYFPRINTF (stderr, "state stack now");
1011 while (yyssp1 != yyssp)
1012 YYFPRINTF (stderr, " %d", *++yyssp1);
1013 YYFPRINTF (stderr, "\n");
1018 ]b4_location_if([ *++yylsp = yyloc;])[
1020 /* Now `shift' the result of the reduction. Determine what state
1021 that goes to, based on the state we popped back to and the rule
1022 number reduced by. */
1026 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1027 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1028 yystate = yytable[yystate];
1030 yystate = yydefgoto[yyn - YYNTOKENS];
1035 /*------------------------------------.
1036 | yyerrlab -- here on detecting error |
1037 `------------------------------------*/
1039 /* If not already recovering from an error, report this error. */
1045 yyn = yypact[yystate];
1047 if (yyn > YYFLAG && yyn < YYLAST)
1049 YYSIZE_T yysize = 0;
1054 /* Start YYX at -YYN if negative to avoid negative indexes in
1056 for (yyx = yyn < 0 ? -yyn : 0;
1057 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1058 if (yycheck[yyx + yyn] == yyx)
1059 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1060 yysize += yystrlen ("parse error, unexpected ") + 1;
1061 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1062 yymsg = (char *) YYSTACK_ALLOC (yysize);
1065 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1066 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1071 for (yyx = yyn < 0 ? -yyn : 0;
1072 yyx < (int) (sizeof (yytname) / sizeof (char *));
1074 if (yycheck[yyx + yyn] == yyx)
1076 const char *yyq = ! yycount ? ", expecting " : " or ";
1077 yyp = yystpcpy (yyp, yyq);
1078 yyp = yystpcpy (yyp, yytname[yyx]);
1083 YYSTACK_FREE (yymsg);
1086 yyerror ("parse error; also virtual memory exhausted");
1089 #endif /* YYERROR_VERBOSE */
1090 yyerror ("parse error");
1095 /*----------------------------------------------------.
1096 | yyerrlab1 -- error raised explicitly by an action. |
1097 `----------------------------------------------------*/
1099 if (yyerrstatus == 3)
1101 /* If just tried and failed to reuse lookahead token after an
1102 error, discard it. */
1104 /* Return failure if at end of input. */
1105 if (yychar == YYEOF)
1107 /* Pop the error token. */
1109 /* Pop the rest of the stack. */
1110 while (yyssp > yyss)
1115 YYFPRINTF (stderr, "Error: popping ");
1118 *yyvsp]b4_location_if([, *yylsp])[);
1119 YYFPRINTF (stderr, "\n");
1122 yydestructor (yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[);
1128 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1129 yychar, yytname[yychar1]));
1130 yydestructor (yychar1, yylval]b4_location_if([, yylloc])[);
1134 /* Else will try to reuse lookahead token after shifting the error
1137 yyerrstatus = 3; /* Each real token shifted decrements this. */
1141 yyn = yypact[yystate];
1145 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1153 /* Pop the current state because it cannot handle the error token. */
1160 YYFPRINTF (stderr, "Error: popping ");
1163 *yyvsp]b4_location_if([, *yylsp])[);
1164 YYFPRINTF (stderr, "\n");
1168 yydestructor (yystos[yystate], *yyvsp]b4_location_if([, *yylsp])[);
1171 ]b4_location_if([ yylsp--;])[
1176 short *yyssp1 = yyss - 1;
1177 YYFPRINTF (stderr, "Error: state stack now");
1178 while (yyssp1 != yyssp)
1179 YYFPRINTF (stderr, " %d", *++yyssp1);
1180 YYFPRINTF (stderr, "\n");
1188 YYDPRINTF ((stderr, "Shifting error token, "));
1191 ]b4_location_if([ *++yylsp = yylloc;])[
1197 /*-------------------------------------.
1198 | yyacceptlab -- YYACCEPT comes here. |
1199 `-------------------------------------*/
1204 /*-----------------------------------.
1205 | yyabortlab -- YYABORT comes here. |
1206 `-----------------------------------*/
1212 /*----------------------------------------------.
1213 | yyoverflowlab -- parser overflow comes here. |
1214 `----------------------------------------------*/
1216 yyerror ("parser stack overflow");
1224 YYSTACK_FREE (yyss);
1230 /*-----------------------------------------------.
1231 | Release the memory associated to this symbol. |
1232 `-----------------------------------------------*/
1234 m4_divert_push([KILL])# M4 code.
1235 # b4_symbol_destructor(SYMBOL-NUMBER, DESTRUCTOR, TYPE-NAME)
1236 # ----------------------------------------------------------
1237 m4_define([b4_symbol_destructor],
1238 [m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl
1239 m4_pushdef([b4_at_dollar], [yylocation])dnl
1243 #line __oline__ "__ofile__"
1245 m4_popdef([b4_at_dollar])dnl
1246 m4_popdef([b4_dollar_dollar])])
1248 m4_divert_pop([KILL])dnl# End of M4 code.
1250 yydestructor (int yytype,
1251 YYSTYPE yyvalue[]b4_location_if([, YYLTYPE yylocation]))
1255 m4_map([b4_symbol_destructor], m4_defn([b4_symbol_destructors]))dnl
1263 /*---------------------------.
1264 | Print this symbol on OUT. |
1265 `---------------------------*/
1267 m4_divert_push([KILL])# M4 code.
1268 # b4_symbol_printer(SYMBOL-NUMBER, PRINTER, TYPE-NAME)
1269 # ----------------------------------------------------------
1270 m4_define([b4_symbol_printer],
1271 [m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl
1272 m4_pushdef([b4_at_dollar], [yylocation])dnl
1276 #line __oline__ "__ofile__"
1278 m4_popdef([b4_at_dollar])dnl
1279 m4_popdef([b4_dollar_dollar])])
1281 m4_divert_pop([KILL])dnl# End of M4 code.
1283 yysymprint (FILE* out, int yytype,
1284 YYSTYPE yyvalue[]b4_location_if([, YYLTYPE yylocation]))
1286 if (yytype < YYNTOKENS)
1287 YYFPRINTF (out, "token %d (%s ", yytoknum[[yytype]], yytname[[yytype]]);
1289 YYFPRINTF (out, "nterm %s (", yytname[[yytype]]);
1291 YYPRINT (out, yytype, yyvalue);
1295 m4_map([b4_symbol_printer], m4_defn([b4_symbol_printers]))dnl
1299 # endif /* !defined YYPRINT. */
1300 YYFPRINTF (out, ")");
1302 #endif /* YYDEBUG. */
1305 m4_if(b4_defines_flag, 0, [],
1306 [#output "b4_output_header_name"
1307 #ifndef b4_header_guard
1308 # define b4_header_guard
1310 b4_token_defines(b4_tokens)
1313 m4_ifdef([b4_stype],
1314 [#line b4_stype_line "b4_filename"
1315 typedef union b4_stype yystype;
1316 /* Line __line__ of __file__. */
1317 #line __oline__ "__ofile__"],
1318 [typedef int yystype;])
1319 # define YYSTYPE yystype
1323 [extern YYSTYPE b4_prefix[]lval;])
1327 typedef struct yyltype
1334 # define YYLTYPE yyltype
1338 [extern YYLTYPE b4_prefix[]lloc;])
1340 #endif /* not b4_header_guard */