1 m4_divert(-1) -*- C
-*-
3 # Yacc compatible skeleton for Bison
5 # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005
6 # Free Software Foundation, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 ## ---------------- ##
27 ## ---------------- ##
30 m4_define_default([b4_stack_depth_max
], [10000])
31 m4_define_default([b4_stack_depth_init
], [200])
34 ## ------------------------ ##
35 ## Pure/impure interfaces. ##
36 ## ------------------------ ##
39 # b4_yacc_pure_if(IF-TRUE, IF-FALSE)
40 # ----------------------------------
41 # Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
42 m4_define([b4_yacc_pure_if
],
43 [b4_pure_if([m4_ifset([b4_parse_param
],
50 # Arguments passed to yyerror: user args plus yylloc.
51 m4_define([b4_yyerror_args
],
52 [b4_yacc_pure_if([b4_location_if([&yylloc
, ])])dnl
53 m4_ifset([b4_parse_param
], [b4_c_args(b4_parse_param
), ])])
58 # Accumulate in b4_lex_param all the yylex arguments.
59 # b4_lex_param arrives quoted twice, but we want to keep only one level.
60 m4_define([b4_lex_param
],
61 m4_dquote(b4_pure_if([[[[YYSTYPE
*]], [[&yylval
]]][]dnl
62 b4_location_if([, [[YYLTYPE
*], [&yylloc
]]])m4_ifdef([b4_lex_param
], [, ])])dnl
63 m4_ifdef([b4_lex_param
], b4_lex_param
)))
71 # b4_int_type(MIN, MAX)
72 # ---------------------
73 # Return the smallest int type able to handle numbers ranging from
74 # MIN to MAX (included). We overwrite the version from c.m4 which relies
75 # on "signed char" which is not portable to old K&R compilers.
76 m4_define([b4_int_type
],
77 [m4_if(b4_ints_in($@
, [0], [255]), [1], [unsigned char],
78 b4_ints_in($@
, [-128], [127]), [1], [yysigned_char
],
80 b4_ints_in($@
, [0], [65535]), [1], [unsigned short int],
81 b4_ints_in($@
, [-32768], [32767]), [1], [short int],
83 m4_eval([0 <= $
1]), [1], [unsigned int],
88 ## ----------------- ##
89 ## Semantic Values. ##
90 ## ----------------- ##
93 # b4_lhs_value([TYPE])
94 # --------------------
95 # Expansion of $<TYPE>$.
96 m4_define([b4_lhs_value
],
97 [(yyval
[]m4_ifval([$
1], [.$
1]))])
100 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
101 # --------------------------------------
102 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
104 m4_define([b4_rhs_value
],
105 [(yyvsp@
{($
2) - ($
1)@
}m4_ifval([$
3], [.$
3]))])
116 m4_define([b4_lhs_location
],
120 # b4_rhs_location(RULE-LENGTH, NUM)
121 # ---------------------------------
122 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
124 m4_define([b4_rhs_location
],
125 [(yylsp@
{($
2) - ($
1)@
})])
129 ## --------------------------------------------------------- ##
130 ## Defining symbol actions, e.g., printers and destructors. ##
131 ## --------------------------------------------------------- ##
133 # We do want M4 expansion after # for CPP macros.
136 @output @output_parser_name@
137 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
138 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])[
140 /* As a special exception, when this parser skeleton is copied by
141 Bison into a Bison output file, you may use that output file
142 without restriction. This special exception was added by the Free
143 Software Foundation for C LALR(1) parsers in version 1.24 of
146 /* C LALR(1) parser skeleton written by Richard Stallman, by
147 simplifying the original so-called "semantic" parser. */
149 /* All symbols defined below should begin with yy or YY, to avoid
150 infringing on user name space. This should be done even for local
151 variables, as they might otherwise be expanded by user macros.
152 There are some unavoidable exceptions within include files to
153 define necessary library symbols; they are noted "INFRINGES ON
154 USER NAME SPACE" below. */
157 m4_if(b4_prefix
[], [yy
], [],
158 [/* Substitute the variable and function names. */
159 #define yyparse b4_prefix[]parse
160 #define yylex b4_prefix[]lex
161 #define yyerror b4_prefix[]error
162 #define yylval b4_prefix[]lval
163 #define yychar b4_prefix[]char
164 #define yydebug b4_prefix[]debug
165 #define yynerrs b4_prefix[]nerrs
166 b4_location_if([#define yylloc b4_prefix[]lloc])])[
168 ]b4_token_enums_defines(b4_tokens
)[
170 /* Copy the first part of user declarations. */
173 /* Enabling traces. */
175 # define YYDEBUG ]b4_debug[
178 /* Enabling verbose error messages. */
179 #ifdef YYERROR_VERBOSE
180 # undef YYERROR_VERBOSE
181 # define YYERROR_VERBOSE 1
183 # define YYERROR_VERBOSE ]b4_error_verbose[
186 /* Enabling the token table. */
187 #ifndef YYTOKEN_TABLE
188 # define YYTOKEN_TABLE ]b4_token_table[
191 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
192 ]m4_ifdef([b4_stype
],
193 [b4_syncline([b4_stype_line
], [b4_file_name
])
194 typedef union m4_bregexp(b4_stype
, [^{], [YYSTYPE
])b4_stype YYSTYPE
;
195 /* Line __line__ of yacc.c. */
196 b4_syncline([@oline@
], [@ofile@
])],
197 [typedef int YYSTYPE
;])[
198 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
199 # define YYSTYPE_IS_DECLARED 1
200 # define YYSTYPE_IS_TRIVIAL 1
203 ]b4_location_if([#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
204 typedef struct YYLTYPE
211 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
212 # define YYLTYPE_IS_DECLARED 1
213 # define YYLTYPE_IS_TRIVIAL 1
217 /* Copy the second part of user declarations. */
220 /* Line __line__ of yacc.c. */
221 b4_syncline([@oline@
], [@ofile@
])[
223 /* Define YYMODERN_C if this compiler supports C89 or better. If
224 __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
225 as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
226 reasons, but it defines __C99__FUNC__ so check that as well.
227 Consider a C++ compiler to be modern if it defines __cplusplus. */
229 # if defined (__STDC__) || defined (__C99__FUNC__) || defined (__cplusplus)
230 # define YYMODERN_C 1
232 # define YYMODERN_C 0
237 # if defined (__SIZE_TYPE__)
238 # define YYSIZE_T __SIZE_TYPE__
239 # elif defined (size_t)
240 # define YYSIZE_T size_t
241 # elif ! defined (YYSIZE_T) && YYMODERN_C
242 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
243 # define YYSIZE_T size_t
245 # define YYSIZE_T unsigned int
249 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
254 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
255 # define YY_(msgid) dgettext ("bison-runtime", msgid)
259 # define YY_(msgid) msgid
263 /* Suppress unused-variable warnings by "using" E. */
265 # define YYUSE(e) ((void) (e))
267 # define YYUSE(e) /* empty */
270 /* Identity function, used to suppress warnings about constant conditions. */
274 ]b4_c_function_def([YYID
], [static int], [[int i
], [i
]])[
280 #if ! defined (yyoverflow) || YYERROR_VERBOSE
282 /* The parser invokes alloca or malloc; define the necessary symbols. */
284 # ifdef YYSTACK_USE_ALLOCA
285 # if YYSTACK_USE_ALLOCA
287 # define YYSTACK_ALLOC __builtin_alloca
288 # elif defined (__BUILTIN_VA_ARG_INCR)
289 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
290 # elif defined (_AIX)
291 # define YYSTACK_ALLOC __alloca
292 # elif defined (_MSC_VER)
293 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
294 # define alloca _alloca
296 # define YYSTACK_ALLOC alloca
297 # if ! defined (_ALLOCA_H) && ! defined (_STDLIB_H) && YYMODERN_C
298 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
307 # ifdef YYSTACK_ALLOC
308 /* Pacify GCC's `empty if-body' warning. */
309 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
310 # ifndef YYSTACK_ALLOC_MAXIMUM
311 /* The OS might guarantee only one guard page at the bottom of the stack,
312 and a page size can be as small as 4096 bytes. So we cannot safely
313 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
314 to allow for a few compiler-allocated temporary stack slots. */
315 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
318 # define YYSTACK_ALLOC YYMALLOC
319 # define YYSTACK_FREE YYFREE
320 # ifndef YYSTACK_ALLOC_MAXIMUM
321 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
327 # define YYMALLOC malloc
328 # if ! defined (malloc) && ! defined (_STDLIB_H) && YYMODERN_C
329 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
334 # if ! defined (free) && ! defined (_STDLIB_H) && YYMODERN_C
335 void free (void *); /* INFRINGES ON USER NAME SPACE */
342 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
345 #if (! defined (yyoverflow) \
346 && (! defined (__cplusplus) \
347 || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
348 && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
350 /* A type that is properly aligned for any stack member. */
355 ]b4_location_if([ YYLTYPE yyls
;
359 /* The size of the maximum gap between one aligned stack and the next. */
360 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
362 /* The size of an array large to enough to hold all stacks, each with
365 [# define YYSTACK_BYTES(N) \
366 ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
367 + 2 * YYSTACK_GAP_MAXIMUM)],
368 [# define YYSTACK_BYTES(N) \
369 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
370 + YYSTACK_GAP_MAXIMUM)])[
372 /* Copy COUNT objects from FROM to TO. The source and destination do
375 # if defined (__GNUC__) && 1 < __GNUC__
376 # define YYCOPY(To, From, Count) \
377 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
379 # define YYCOPY(To, From, Count) \
383 for (yyi = 0; yyi < (Count); yyi++) \
384 (To)[yyi] = (From)[yyi]; \
390 /* Relocate STACK from its old location to the new one. The
391 local variables YYSIZE and YYSTACKSIZE give the old and new number of
392 elements in the stack, and YYPTR gives the new location of the
393 stack. Advance YYPTR to a properly aligned location for the next
395 # define YYSTACK_RELOCATE(Stack) \
398 YYSIZE_T yynewbytes; \
399 YYCOPY (&yyptr->Stack, Stack, yysize); \
400 Stack = &yyptr->Stack; \
401 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
402 yyptr += yynewbytes / sizeof (*yyptr); \
409 typedef signed char yysigned_char
;
411 typedef short int yysigned_char
;
414 /* YYFINAL -- State number of the termination state. */
415 #define YYFINAL ]b4_final_state_number[
416 /* YYLAST -- Last index in YYTABLE. */
417 #define YYLAST ]b4_last[
419 /* YYNTOKENS -- Number of terminals. */
420 #define YYNTOKENS ]b4_tokens_number[
421 /* YYNNTS -- Number of nonterminals. */
422 #define YYNNTS ]b4_nterms_number[
423 /* YYNRULES -- Number of rules. */
424 #define YYNRULES ]b4_rules_number[
425 /* YYNRULES -- Number of states. */
426 #define YYNSTATES ]b4_states_number[
428 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
429 #define YYUNDEFTOK ]b4_undef_token_number[
430 #define YYMAXUTOK ]b4_user_token_number_max[
432 #define YYTRANSLATE(YYX) \
433 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
435 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
436 static const ]b4_int_type_for([b4_translate
])[ yytranslate
[] =
442 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
444 static const ]b4_int_type_for([b4_prhs
])[ yyprhs
[] =
449 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
450 static const ]b4_int_type_for([b4_rhs
])[ yyrhs
[] =
455 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
456 static const ]b4_int_type_for([b4_rline
])[ yyrline
[] =
462 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
463 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
464 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
465 static const char *const yytname
[] =
472 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
474 static const ]b4_int_type_for([b4_toknum
])[ yytoknum
[] =
480 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
481 static const ]b4_int_type_for([b4_r1
])[ yyr1
[] =
486 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
487 static const ]b4_int_type_for([b4_r2
])[ yyr2
[] =
492 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
493 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
494 means the default is an error. */
495 static const ]b4_int_type_for([b4_defact
])[ yydefact
[] =
500 /* YYDEFGOTO[NTERM-NUM]. */
501 static const ]b4_int_type_for([b4_defgoto
])[ yydefgoto
[] =
506 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
508 #define YYPACT_NINF ]b4_pact_ninf[
509 static const ]b4_int_type_for([b4_pact
])[ yypact
[] =
514 /* YYPGOTO[NTERM-NUM]. */
515 static const ]b4_int_type_for([b4_pgoto
])[ yypgoto
[] =
520 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
521 positive, shift that token. If negative, reduce the rule which
522 number is the opposite. If zero, do what YYDEFACT says.
523 If YYTABLE_NINF, syntax error. */
524 #define YYTABLE_NINF ]b4_table_ninf[
525 static const ]b4_int_type_for([b4_table
])[ yytable
[] =
530 static const ]b4_int_type_for([b4_check
])[ yycheck
[] =
535 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
536 symbol of state STATE-NUM. */
537 static const ]b4_int_type_for([b4_stos
])[ yystos
[] =
542 #define yyerrok (yyerrstatus = 0)
543 #define yyclearin (yychar = YYEMPTY)
547 #define YYACCEPT goto yyacceptlab
548 #define YYABORT goto yyabortlab
549 #define YYERROR goto yyerrorlab
552 /* Like YYERROR except do call yyerror. This remains here temporarily
553 to ease the transition to the new meaning of YYERROR, for GCC.
554 Once GCC version 2 has supplanted version 1, this can go. */
556 #define YYFAIL goto yyerrlab
558 #define YYRECOVERING() (!!yyerrstatus)
560 #define YYBACKUP(Token, Value) \
562 if (yychar == YYEMPTY && yylen == 1) \
566 yytoken = YYTRANSLATE (yychar); \
572 yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
579 #define YYERRCODE 256
582 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
583 If N is 0, then set CURRENT to the empty location which ends
584 the previous symbol: RHS[0] (always defined). */
586 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
587 #ifndef YYLLOC_DEFAULT
588 # define YYLLOC_DEFAULT(Current, Rhs, N) \
592 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
593 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
594 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
595 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
599 (Current).first_line = (Current).last_line = \
600 YYRHSLOC (Rhs, 0).last_line; \
601 (Current).first_column = (Current).last_column = \
602 YYRHSLOC (Rhs, 0).last_column; \
608 /* YY_LOCATION_PRINT -- Print the location on the stream.
609 This macro was not mandated originally: define only if we know
610 we won't break user code: when these are the locations we know. */
612 #ifndef YY_LOCATION_PRINT
613 # if YYLTYPE_IS_TRIVIAL
614 # define YY_LOCATION_PRINT(File, Loc) \
615 fprintf (File, "%d.%d-%d.%d", \
616 (Loc).first_line, (Loc).first_column, \
617 (Loc).last_line, (Loc).last_column)
619 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
624 /* YYLEX -- calling `yylex' with the right arguments. */
627 # define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM)
629 # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
632 /* Enable debugging if requested. */
636 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
637 # define YYFPRINTF fprintf
640 # define YYDPRINTF(Args) \
646 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
650 YYFPRINTF (stderr, "%s ", Title); \
651 yysymprint (stderr, \
652 Type, Value]b4_location_if([, Location])[]b4_user_args[); \
653 YYFPRINTF (stderr, "\n"); \
657 ]b4_yysymprint_generate([b4_c_function_def
])[
659 /*------------------------------------------------------------------.
660 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
662 `------------------------------------------------------------------*/
664 ]b4_c_function_def([yy_stack_print
], [static void],
665 [[short int *bottom
], [bottom
]],
666 [[short int *top
], [top
]])[
668 YYFPRINTF (stderr
, "Stack now");
669 for (/* Nothing. */; bottom
<= top
; ++bottom
)
670 YYFPRINTF (stderr
, " %d", *bottom
);
671 YYFPRINTF (stderr
, "\n");
674 # define YY_STACK_PRINT(Bottom, Top) \
677 yy_stack_print ((Bottom), (Top)); \
681 /*------------------------------------------------.
682 | Report that the YYRULE is going to be reduced. |
683 `------------------------------------------------*/
685 ]b4_c_function_def([yy_reduce_print
], [static void],
686 [[YYSTYPE
*yyvsp
], [yyvsp
]],
687 b4_location_if([[[YYLTYPE
*yylsp
], [yylsp
]],])
688 [[int yyrule
], [yyrule
]]m4_ifset([b4_parse_param
], [,])
691 int yynrhs
= yyr2
[yyrule
];
693 unsigned long int yylno
= yyrline
[yyrule
];
694 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
696 /* The symbols being reduced. */
697 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
699 fprintf (stderr
, " $%d = ", yyi
+ 1);
700 yysymprint (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
701 &]b4_rhs_value(yynrhs
, yyi
+ 1)[
702 ]b4_location_if([, &]b4_rhs_location(yynrhs
, yyi
+ 1))[]dnl
704 fprintf (stderr
, "\n");
708 # define YY_REDUCE_PRINT(Rule) \
711 yy_reduce_print (yyvsp, ]b4_location_if([yylsp, ])[Rule]b4_user_args[); \
714 /* Nonzero means print parse trace. It is left uninitialized so that
715 multiple parsers can coexist. */
718 # define YYDPRINTF(Args)
719 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
720 # define YY_STACK_PRINT(Bottom, Top)
721 # define YY_REDUCE_PRINT(Rule)
722 #endif /* !YYDEBUG */
725 /* YYINITDEPTH -- initial size of the parser's stacks. */
727 # define YYINITDEPTH ]b4_stack_depth_init[
730 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
731 if the built-in stack extension method is used).
733 Do not make this value too large; the results are undefined if
734 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
735 evaluated with infinite-precision integer arithmetic. */
738 # define YYMAXDEPTH ]b4_stack_depth_max[
746 # if defined (__GLIBC__) && defined (_STRING_H)
747 # define yystrlen strlen
749 /* Return the length of YYSTR. */
752 yystrlen (const char *yystr
)
759 for (yylen
= 0; yystr
[yylen
]; yylen
++)
767 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
768 # define yystpcpy stpcpy
770 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
774 yystpcpy (char *yydest
, const char *yysrc
)
776 yystpcpy (yydest
, yysrc
)
782 const char *yys
= yysrc
;
784 while ((*yyd
++ = *yys
++) != '\0')
793 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
794 quotes and backslashes, so that it's suitable for yyerror. The
795 heuristic is that double-quoting is unnecessary unless the string
796 contains an apostrophe, a comma, or backslash (other than
797 backslash-backslash). YYSTR is taken from yytname. If YYRES is
798 null, do not copy; instead, return the length of what the result
801 yytnamerr (char *yyres
, const char *yystr
)
806 char const *yyp
= yystr
;
813 goto do_not_strip_quotes
;
817 goto do_not_strip_quotes
;
830 do_not_strip_quotes
: ;
834 return yystrlen (yystr
);
836 return yystpcpy (yyres
, yystr
) - yyres
;
840 /* Copy into YYRESULT an error message about the unexpected token
841 YYCHAR while in state YYSTATE. Return the number of bytes copied,
842 including the terminating null byte. If YYRESULT is null, do not
843 copy anything; just return the number of bytes that would be
844 copied. As a special case, return 0 if an ordinary "syntax error"
845 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
848 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
850 int yyn
= yypact
[yystate
];
852 if (! (YYPACT_NINF
< yyn
&& yyn
< YYLAST
))
856 int yytype
= YYTRANSLATE (yychar
);
857 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
858 YYSIZE_T yysize
= yysize0
;
860 int yysize_overflow
= 0;
861 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
862 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
866 /* This is so xgettext sees the translatable formats that are
867 constructed on the fly. */
868 YY_("syntax error, unexpected %s");
869 YY_("syntax error, unexpected %s, expecting %s");
870 YY_("syntax error, unexpected %s, expecting %s or %s");
871 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
872 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
876 static char const yyunexpected
[] = "syntax error, unexpected %s";
877 static char const yyexpecting
[] = ", expecting %s";
878 static char const yyor
[] = " or %s";
879 char yyformat
[sizeof yyunexpected
880 + sizeof yyexpecting
- 1
881 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
882 * (sizeof yyor
- 1))];
883 char const *yyprefix
= yyexpecting
;
885 /* Start YYX at -YYN if negative to avoid negative indexes in
887 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
889 /* Stay within bounds of both yycheck and yytname. */
890 int yychecklim
= YYLAST
- yyn
;
891 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
894 yyarg
[0] = yytname
[yytype
];
895 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
897 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
898 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
900 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
904 yyformat
[sizeof yyunexpected
- 1] = '\0';
907 yyarg
[yycount
++] = yytname
[yyx
];
908 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
909 yysize_overflow
|= (yysize1
< yysize
);
911 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
916 yysize1
= yysize
+ yystrlen (yyf
);
917 yysize_overflow
|= (yysize1
< yysize
);
921 return YYSIZE_MAXIMUM
;
925 /* Avoid sprintf, as that infringes on the user's name space.
926 Don't have undefined behavior even if the translation
927 produced a string with the wrong number of "%s"s. */
928 char *yyp
= yyresult
;
930 while ((*yyp
= *yyf
) != '\0')
932 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
934 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
947 #endif /* YYERROR_VERBOSE */
950 ]b4_yydestruct_generate([b4_c_function_def
])[
953 /* Prevent warnings from -Wmissing-prototypes. */
957 int yyparse (void *YYPARSE_PARAM
);
961 #else /* ! YYPARSE_PARAM */
962 ]b4_c_function_decl([yyparse
], [int], b4_parse_param
)[
963 #endif /* ! YYPARSE_PARAM */
966 ]m4_divert_push([KILL
])# ======================== M4 code.
967 # b4_declare_parser_variables
968 # ---------------------------
969 # Declare the variables that are global, or local to YYPARSE if
971 m4_define([b4_declare_parser_variables
],
972 [/* The look-ahead symbol. */
975 /* The semantic value of the look-ahead symbol. */
978 /* Number of syntax errors so far. */
979 int yynerrs
;b4_location_if([
980 /* Location data for the look-ahead symbol. */
983 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
986 [b4_declare_parser_variables
])
995 int yyparse (void *YYPARSE_PARAM
)
997 int yyparse (YYPARSE_PARAM
)
1000 #else /* ! YYPARSE_PARAM */
1001 b4_c_function_def([yyparse
], [int], b4_parse_param
)
1004 ]b4_pure_if([b4_declare_parser_variables
])[
1008 /* Number of tokens to shift before error messages enabled. */
1010 /* Look-ahead token as an internal (translated) token number. */
1013 /* Buffer for error messages, and its allocated size. */
1015 char *yymsg
= yymsgbuf
;
1016 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1019 /* Three stacks and their tools:
1020 `yyss': related to states,
1021 `yyvs': related to semantic values,
1022 `yyls': related to locations.
1024 Refer to the stacks thru separate pointers, to allow yyoverflow
1025 to reallocate them elsewhere. */
1027 /* The state stack. */
1028 short int yyssa
[YYINITDEPTH
];
1029 short int *yyss
= yyssa
;
1032 /* The semantic value stack. */
1033 YYSTYPE yyvsa
[YYINITDEPTH
];
1034 YYSTYPE
*yyvs
= yyvsa
;
1038 [[ /* The location stack. */
1039 YYLTYPE yylsa
[YYINITDEPTH
];
1040 YYLTYPE
*yyls
= yylsa
;
1042 /* The locations where the error started and ended. */
1043 YYLTYPE yyerror_range
[2];]])[
1045 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
1047 YYSIZE_T yystacksize
= YYINITDEPTH
;
1049 /* The variables used to return semantic value and location from the
1052 ]b4_location_if([ YYLTYPE yyloc
;])[
1054 /* When reducing, the number of symbols on the RHS of the reduced
1058 YYDPRINTF ((stderr
, "Starting parse\n"));
1063 yychar
= YYEMPTY
; /* Cause a token to be read. */
1065 /* Initialize stack pointers.
1066 Waste one element of value and location stack
1067 so that they stay on the same level as the state stack.
1068 The wasted elements are never initialized. */
1072 ]b4_location_if([[ yylsp
= yyls
;
1073 #if YYLTYPE_IS_TRIVIAL
1074 /* Initialize the default location before parsing starts. */
1075 yylloc
.first_line
= yylloc
.last_line
= 1;
1076 yylloc
.first_column
= yylloc
.last_column
= 0;
1079 m4_ifdef([b4_initial_action
], [
1080 m4_pushdef([b4_at_dollar
], [m4_define([b4_at_dollar_used
])yylloc
])dnl
1081 m4_pushdef([b4_dollar_dollar
], [m4_define([b4_dollar_dollar_used
])yylval
])dnl
1082 /* User initialization code. */
1084 m4_popdef([b4_dollar_dollar
])dnl
1085 m4_popdef([b4_at_dollar
])dnl
1086 /* Line __line__ of yacc.c. */
1087 b4_syncline([@oline@
], [@ofile@
])
1089 m4_ifdef([b4_dollar_dollar_used
],[[ yyvsp
[0] = yylval
;
1091 m4_ifdef([b4_at_dollar_used
], [[ yylsp
[0] = yylloc
;
1095 /*------------------------------------------------------------.
1096 | yynewstate -- Push a new state, which is found in yystate. |
1097 `------------------------------------------------------------*/
1099 /* In all cases, when you get here, the value and location stacks
1100 have just been pushed. so pushing a state here evens the stacks.
1107 if (yyss
+ yystacksize
- 1 <= yyssp
)
1109 /* Get the current used size of the three stacks, in elements. */
1110 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1114 /* Give user a chance to reallocate the stack. Use copies of
1115 these so that the &'s don't force the real ones into
1117 YYSTYPE
*yyvs1
= yyvs
;
1118 short int *yyss1
= yyss
;
1119 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
1121 /* Each stack pointer address is followed by the size of the
1122 data in use in that stack, in bytes. This used to be a
1123 conditional around just the two extra args, but that might
1124 be undefined if yyoverflow is a macro. */
1125 yyoverflow (YY_("memory exhausted"),
1126 &yyss1
, yysize
* sizeof (*yyssp
),
1127 &yyvs1
, yysize
* sizeof (*yyvsp
),
1128 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
1130 ]b4_location_if([ yyls
= yyls1
;])[
1134 #else /* no yyoverflow */
1135 # ifndef YYSTACK_RELOCATE
1136 goto yyexhaustedlab
;
1138 /* Extend the stack our own way. */
1139 if (YYMAXDEPTH
<= yystacksize
)
1140 goto yyexhaustedlab
;
1142 if (YYMAXDEPTH
< yystacksize
)
1143 yystacksize
= YYMAXDEPTH
;
1146 short int *yyss1
= yyss
;
1147 union yyalloc
*yyptr
=
1148 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1150 goto yyexhaustedlab
;
1151 YYSTACK_RELOCATE (yyss
);
1152 YYSTACK_RELOCATE (yyvs
);
1153 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
1154 # undef YYSTACK_RELOCATE
1156 YYSTACK_FREE (yyss1
);
1159 #endif /* no yyoverflow */
1161 yyssp
= yyss
+ yysize
- 1;
1162 yyvsp
= yyvs
+ yysize
- 1;
1163 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
1165 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1166 (unsigned long int) yystacksize
));
1168 if (yyss
+ yystacksize
- 1 <= yyssp
)
1172 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1181 /* Do appropriate processing given the current state. */
1182 /* Read a look-ahead token if we need one and don't already have one. */
1185 /* First try to decide what to do without reference to look-ahead token. */
1187 yyn
= yypact
[yystate
];
1188 if (yyn
== YYPACT_NINF
)
1191 /* Not known => get a look-ahead token if don't already have one. */
1193 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1194 if (yychar
== YYEMPTY
)
1196 YYDPRINTF ((stderr
, "Reading a token: "));
1200 if (yychar
<= YYEOF
)
1202 yychar
= yytoken
= YYEOF
;
1203 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1207 yytoken
= YYTRANSLATE (yychar
);
1208 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1211 /* If the proper action on seeing token YYTOKEN is to reduce or to
1212 detect an error, take that action. */
1214 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1219 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1228 /* Shift the look-ahead token. */
1229 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1231 /* Discard the token being shifted unless it is eof. */
1232 if (yychar
!= YYEOF
)
1236 ]b4_location_if([ *++yylsp
= yylloc
;])[
1238 /* Count tokens shifted since error; after three, turn off error
1247 /*-----------------------------------------------------------.
1248 | yydefault -- do the default action for the current state. |
1249 `-----------------------------------------------------------*/
1251 yyn
= yydefact
[yystate
];
1257 /*-----------------------------.
1258 | yyreduce -- Do a reduction. |
1259 `-----------------------------*/
1261 /* yyn is the number of a rule to reduce with. */
1264 /* If YYLEN is nonzero, implement the default value of the action:
1267 Otherwise, the following line sets YYVAL to garbage.
1268 This behavior is undocumented and Bison
1269 users should not rely upon it. Assigning to YYVAL
1270 unconditionally makes the parser a bit smaller, and it avoids a
1271 GCC warning that YYVAL may be used uninitialized. */
1272 yyval
= yyvsp
[1-yylen
];
1275 [[ /* Default location. */
1276 YYLLOC_DEFAULT (yyloc
, yylsp
- yylen
, yylen
);]])[
1277 YY_REDUCE_PRINT (yyn
);
1283 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
1285 /* Line __line__ of yacc.c. */
1286 ]b4_syncline([@oline@
], [@ofile@
])[
1290 ]b4_location_if([ yylsp
-= yylen
;])[
1292 YY_STACK_PRINT (yyss
, yyssp
);
1295 ]b4_location_if([ *++yylsp
= yyloc
;])[
1297 /* Now `shift' the result of the reduction. Determine what state
1298 that goes to, based on the state we popped back to and the rule
1299 number reduced by. */
1303 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1304 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1305 yystate
= yytable
[yystate
];
1307 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1312 /*------------------------------------.
1313 | yyerrlab -- here on detecting error |
1314 `------------------------------------*/
1316 /* If not already recovering from an error, report this error. */
1320 #if ! YYERROR_VERBOSE
1321 yyerror (]b4_yyerror_args
[YY_("syntax error"));
1324 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
1325 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
1327 YYSIZE_T yyalloc
= 2 * yysize
;
1328 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
1329 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
1330 if (yymsg
!= yymsgbuf
)
1331 YYSTACK_FREE (yymsg
);
1332 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
1334 yymsg_alloc
= yyalloc
;
1338 yymsg_alloc
= sizeof yymsgbuf
;
1342 if (0 < yysize
&& yysize
<= yymsg_alloc
)
1344 (void) yysyntax_error (yymsg
, yystate
, yychar
);
1345 yyerror (]b4_yyerror_args
[yymsg
);
1349 yyerror (]b4_yyerror_args
[YY_("syntax error"));
1351 goto yyexhaustedlab
;
1357 ]b4_location_if([[ yyerror_range
[0] = yylloc
;]])[
1359 if (yyerrstatus
== 3)
1361 /* If just tried and failed to reuse look-ahead token after an
1362 error, discard it. */
1364 if (yychar
<= YYEOF
)
1366 /* Return failure if at end of input. */
1367 if (yychar
== YYEOF
)
1372 yydestruct ("Error: discarding",
1373 yytoken
, &yylval
]b4_location_if([, &yylloc
])[]b4_user_args
[);
1378 /* Else will try to reuse look-ahead token after shifting the error
1383 /*---------------------------------------------------.
1384 | yyerrorlab -- error raised explicitly by YYERROR. |
1385 `---------------------------------------------------*/
1388 /* Pacify compilers like GCC when the user code never invokes
1389 YYERROR and the label yyerrorlab therefore never appears in user
1391 if (/*CONSTCOND*/ 0)
1394 ]b4_location_if([[ yyerror_range
[0] = yylsp
[1-yylen
];
1402 /*-------------------------------------------------------------.
1403 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1404 `-------------------------------------------------------------*/
1406 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1410 yyn
= yypact
[yystate
];
1411 if (yyn
!= YYPACT_NINF
)
1414 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1422 /* Pop the current state because it cannot handle the error token. */
1426 ]b4_location_if([[ yyerror_range
[0] = *yylsp
;]])[
1427 yydestruct ("Error: popping",
1428 yystos
[yystate
], yyvsp
]b4_location_if([, yylsp
])[]b4_user_args
[);
1431 YY_STACK_PRINT (yyss
, yyssp
);
1439 yyerror_range
[1] = yylloc
;
1440 /* Using YYLLOC is tempting, but would change the location of
1441 the look-ahead. YYLOC is available though. */
1442 YYLLOC_DEFAULT (yyloc
, yyerror_range
- 1, 2);
1443 *++yylsp
= yyloc
;]])[
1445 /* Shift the error token. */
1446 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1452 /*-------------------------------------.
1453 | yyacceptlab -- YYACCEPT comes here. |
1454 `-------------------------------------*/
1459 /*-----------------------------------.
1460 | yyabortlab -- YYABORT comes here. |
1461 `-----------------------------------*/
1467 /*-------------------------------------------------.
1468 | yyexhaustedlab -- memory exhaustion comes here. |
1469 `-------------------------------------------------*/
1471 yyerror (]b4_yyerror_args
[YY_("memory exhausted"));
1477 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
1478 yydestruct ("Cleanup: discarding lookahead",
1479 yytoken
, &yylval
]b4_location_if([, &yylloc
])[]b4_user_args
[);
1480 while (yyssp
!= yyss
)
1482 yydestruct ("Cleanup: popping",
1483 yystos
[*yyssp
], yyvsp
]b4_location_if([, yylsp
])[]b4_user_args
[);
1488 YYSTACK_FREE (yyss
);
1491 if (yymsg
!= yymsgbuf
)
1492 YYSTACK_FREE (yymsg
);
1499 m4_if(b4_defines_flag
, 0, [],
1500 [@output @output_header_name@
1501 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1502 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])
1504 /* As a special exception, when this file is copied by Bison into a
1505 Bison output file, you may use that output file without restriction.
1506 This special exception was added by the Free Software Foundation
1507 in version 1.24 of Bison. */
1509 b4_token_enums_defines(b4_tokens
)
1511 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1512 m4_ifdef([b4_stype
],
1513 [b4_syncline([b4_stype_line
], [b4_file_name
])
1514 typedef union m4_bregexp(b4_stype
, [^{], [YYSTYPE
])b4_stype YYSTYPE
;
1515 /* Line __line__ of yacc.c. */
1516 b4_syncline([@oline@
], [@ofile@
])],
1517 [typedef int YYSTYPE
;])
1518 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1519 # define YYSTYPE_IS_DECLARED 1
1520 # define YYSTYPE_IS_TRIVIAL 1
1524 [extern YYSTYPE b4_prefix
[]lval
;])
1527 [#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
1528 typedef struct YYLTYPE
1535 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
1536 # define YYLTYPE_IS_DECLARED 1
1537 # define YYLTYPE_IS_TRIVIAL 1
1541 [extern YYLTYPE b4_prefix
[]lloc
;])