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. */
264 #define YYUSE(e) do {;} while (/*CONSTCOND*/ 0 && (e))
266 #if ! defined (yyoverflow) || YYERROR_VERBOSE
268 /* The parser invokes alloca or malloc; define the necessary symbols. */
270 # ifdef YYSTACK_USE_ALLOCA
271 # if YYSTACK_USE_ALLOCA
273 # define YYSTACK_ALLOC __builtin_alloca
274 # elif defined (__BUILTIN_VA_ARG_INCR)
275 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
276 # elif defined (_AIX)
277 # define YYSTACK_ALLOC __alloca
278 # elif defined (_MSC_VER)
279 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
280 # define alloca _alloca
282 # define YYSTACK_ALLOC alloca
283 # if ! defined (_ALLOCA_H) && ! defined (_STDLIB_H) && YYMODERN_C
284 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
293 # ifdef YYSTACK_ALLOC
294 /* Pacify GCC's `empty if-body' warning. */
295 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
296 # ifndef YYSTACK_ALLOC_MAXIMUM
297 /* The OS might guarantee only one guard page at the bottom of the stack,
298 and a page size can be as small as 4096 bytes. So we cannot safely
299 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
300 to allow for a few compiler-allocated temporary stack slots. */
301 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
304 # define YYSTACK_ALLOC YYMALLOC
305 # define YYSTACK_FREE YYFREE
306 # ifndef YYSTACK_ALLOC_MAXIMUM
307 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
313 # define YYMALLOC malloc
314 # if ! defined (malloc) && ! defined (_STDLIB_H) && YYMODERN_C
315 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
320 # if ! defined (free) && ! defined (_STDLIB_H) && YYMODERN_C
321 void free (void *); /* INFRINGES ON USER NAME SPACE */
328 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
331 #if (! defined (yyoverflow) \
332 && (! defined (__cplusplus) \
333 || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
334 && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
336 /* A type that is properly aligned for any stack member. */
341 ]b4_location_if([ YYLTYPE yyls
;
345 /* The size of the maximum gap between one aligned stack and the next. */
346 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
348 /* The size of an array large to enough to hold all stacks, each with
351 [# define YYSTACK_BYTES(N) \
352 ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
353 + 2 * YYSTACK_GAP_MAXIMUM)],
354 [# define YYSTACK_BYTES(N) \
355 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
356 + YYSTACK_GAP_MAXIMUM)])[
358 /* Copy COUNT objects from FROM to TO. The source and destination do
361 # if defined (__GNUC__) && 1 < __GNUC__
362 # define YYCOPY(To, From, Count) \
363 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
365 # define YYCOPY(To, From, Count) \
369 for (yyi = 0; yyi < (Count); yyi++) \
370 (To)[yyi] = (From)[yyi]; \
372 while (/*CONSTCOND*/ 0)
376 /* Relocate STACK from its old location to the new one. The
377 local variables YYSIZE and YYSTACKSIZE give the old and new number of
378 elements in the stack, and YYPTR gives the new location of the
379 stack. Advance YYPTR to a properly aligned location for the next
381 # define YYSTACK_RELOCATE(Stack) \
384 YYSIZE_T yynewbytes; \
385 YYCOPY (&yyptr->Stack, Stack, yysize); \
386 Stack = &yyptr->Stack; \
387 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
388 yyptr += yynewbytes / sizeof (*yyptr); \
390 while (/*CONSTCOND*/ 0)
395 typedef signed char yysigned_char
;
397 typedef short int yysigned_char
;
400 /* YYFINAL -- State number of the termination state. */
401 #define YYFINAL ]b4_final_state_number[
402 /* YYLAST -- Last index in YYTABLE. */
403 #define YYLAST ]b4_last[
405 /* YYNTOKENS -- Number of terminals. */
406 #define YYNTOKENS ]b4_tokens_number[
407 /* YYNNTS -- Number of nonterminals. */
408 #define YYNNTS ]b4_nterms_number[
409 /* YYNRULES -- Number of rules. */
410 #define YYNRULES ]b4_rules_number[
411 /* YYNRULES -- Number of states. */
412 #define YYNSTATES ]b4_states_number[
414 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
415 #define YYUNDEFTOK ]b4_undef_token_number[
416 #define YYMAXUTOK ]b4_user_token_number_max[
418 #define YYTRANSLATE(YYX) \
419 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
421 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
422 static const ]b4_int_type_for([b4_translate
])[ yytranslate
[] =
428 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
430 static const ]b4_int_type_for([b4_prhs
])[ yyprhs
[] =
435 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
436 static const ]b4_int_type_for([b4_rhs
])[ yyrhs
[] =
441 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
442 static const ]b4_int_type_for([b4_rline
])[ yyrline
[] =
448 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
449 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
450 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
451 static const char *const yytname
[] =
458 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
460 static const ]b4_int_type_for([b4_toknum
])[ yytoknum
[] =
466 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
467 static const ]b4_int_type_for([b4_r1
])[ yyr1
[] =
472 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
473 static const ]b4_int_type_for([b4_r2
])[ yyr2
[] =
478 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
479 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
480 means the default is an error. */
481 static const ]b4_int_type_for([b4_defact
])[ yydefact
[] =
486 /* YYDEFGOTO[NTERM-NUM]. */
487 static const ]b4_int_type_for([b4_defgoto
])[ yydefgoto
[] =
492 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
494 #define YYPACT_NINF ]b4_pact_ninf[
495 static const ]b4_int_type_for([b4_pact
])[ yypact
[] =
500 /* YYPGOTO[NTERM-NUM]. */
501 static const ]b4_int_type_for([b4_pgoto
])[ yypgoto
[] =
506 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
507 positive, shift that token. If negative, reduce the rule which
508 number is the opposite. If zero, do what YYDEFACT says.
509 If YYTABLE_NINF, syntax error. */
510 #define YYTABLE_NINF ]b4_table_ninf[
511 static const ]b4_int_type_for([b4_table
])[ yytable
[] =
516 static const ]b4_int_type_for([b4_check
])[ yycheck
[] =
521 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
522 symbol of state STATE-NUM. */
523 static const ]b4_int_type_for([b4_stos
])[ yystos
[] =
528 #define yyerrok (yyerrstatus = 0)
529 #define yyclearin (yychar = YYEMPTY)
533 #define YYACCEPT goto yyacceptlab
534 #define YYABORT goto yyabortlab
535 #define YYERROR goto yyerrorlab
538 /* Like YYERROR except do call yyerror. This remains here temporarily
539 to ease the transition to the new meaning of YYERROR, for GCC.
540 Once GCC version 2 has supplanted version 1, this can go. */
542 #define YYFAIL goto yyerrlab
544 #define YYRECOVERING() (!!yyerrstatus)
546 #define YYBACKUP(Token, Value) \
548 if (yychar == YYEMPTY && yylen == 1) \
552 yytoken = YYTRANSLATE (yychar); \
558 yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
561 while (/*CONSTCOND*/ 0)
565 #define YYERRCODE 256
568 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
569 If N is 0, then set CURRENT to the empty location which ends
570 the previous symbol: RHS[0] (always defined). */
572 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
573 #ifndef YYLLOC_DEFAULT
574 # define YYLLOC_DEFAULT(Current, Rhs, N) \
578 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
579 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
580 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
581 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
585 (Current).first_line = (Current).last_line = \
586 YYRHSLOC (Rhs, 0).last_line; \
587 (Current).first_column = (Current).last_column = \
588 YYRHSLOC (Rhs, 0).last_column; \
590 while (/*CONSTCOND*/ 0)
594 /* YY_LOCATION_PRINT -- Print the location on the stream.
595 This macro was not mandated originally: define only if we know
596 we won't break user code: when these are the locations we know. */
598 #ifndef YY_LOCATION_PRINT
599 # if YYLTYPE_IS_TRIVIAL
600 # define YY_LOCATION_PRINT(File, Loc) \
601 fprintf (File, "%d.%d-%d.%d", \
602 (Loc).first_line, (Loc).first_column, \
603 (Loc).last_line, (Loc).last_column)
605 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
610 /* YYLEX -- calling `yylex' with the right arguments. */
613 # define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM)
615 # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
618 /* Enable debugging if requested. */
622 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
623 # define YYFPRINTF fprintf
626 # define YYDPRINTF(Args) \
630 } while (/*CONSTCOND*/ 0)
632 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
636 YYFPRINTF (stderr, "%s ", Title); \
637 yysymprint (stderr, \
638 Type, Value]b4_location_if([, Location])[]b4_user_args[); \
639 YYFPRINTF (stderr, "\n"); \
641 } while (/*CONSTCOND*/ 0)
643 ]b4_yysymprint_generate([b4_c_function_def
])[
645 /*------------------------------------------------------------------.
646 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
648 `------------------------------------------------------------------*/
650 ]b4_c_function_def([yy_stack_print
], [static void],
651 [[short int *bottom
], [bottom
]],
652 [[short int *top
], [top
]])[
654 YYFPRINTF (stderr
, "Stack now");
655 for (/* Nothing. */; bottom
<= top
; ++bottom
)
656 YYFPRINTF (stderr
, " %d", *bottom
);
657 YYFPRINTF (stderr
, "\n");
660 # define YY_STACK_PRINT(Bottom, Top) \
663 yy_stack_print ((Bottom), (Top)); \
664 } while (/*CONSTCOND*/ 0)
667 /*------------------------------------------------.
668 | Report that the YYRULE is going to be reduced. |
669 `------------------------------------------------*/
671 ]b4_c_function_def([yy_reduce_print
], [static void],
672 [[YYSTYPE
*yyvsp
], [yyvsp
]],
673 b4_location_if([[[YYLTYPE
*yylsp
], [yylsp
]],])
674 [[int yyrule
], [yyrule
]]m4_ifset([b4_parse_param
], [,])
677 int yynrhs
= yyr2
[yyrule
];
679 unsigned long int yylno
= yyrline
[yyrule
];
680 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
682 /* The symbols being reduced. */
683 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
685 fprintf (stderr
, " $%d = ", yyi
+ 1);
686 yysymprint (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
687 &]b4_rhs_value(yynrhs
, yyi
+ 1)[
688 ]b4_location_if([, &]b4_rhs_location(yynrhs
, yyi
+ 1))[]dnl
690 fprintf (stderr
, "\n");
694 # define YY_REDUCE_PRINT(Rule) \
697 yy_reduce_print (yyvsp, ]b4_location_if([yylsp, ])[Rule]b4_user_args[); \
698 } while (/*CONSTCOND*/ 0)
700 /* Nonzero means print parse trace. It is left uninitialized so that
701 multiple parsers can coexist. */
704 # define YYDPRINTF(Args)
705 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
706 # define YY_STACK_PRINT(Bottom, Top)
707 # define YY_REDUCE_PRINT(Rule)
708 #endif /* !YYDEBUG */
711 /* YYINITDEPTH -- initial size of the parser's stacks. */
713 # define YYINITDEPTH ]b4_stack_depth_init[
716 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
717 if the built-in stack extension method is used).
719 Do not make this value too large; the results are undefined if
720 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
721 evaluated with infinite-precision integer arithmetic. */
724 # define YYMAXDEPTH ]b4_stack_depth_max[
732 # if defined (__GLIBC__) && defined (_STRING_H)
733 # define yystrlen strlen
735 /* Return the length of YYSTR. */
738 yystrlen (const char *yystr
)
744 const char *yys
= yystr
;
746 while (*yys
++ != '\0')
749 return yys
- yystr
- 1;
755 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
756 # define yystpcpy stpcpy
758 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
762 yystpcpy (char *yydest
, const char *yysrc
)
764 yystpcpy (yydest
, yysrc
)
770 const char *yys
= yysrc
;
772 while ((*yyd
++ = *yys
++) != '\0')
781 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
782 quotes and backslashes, so that it's suitable for yyerror. The
783 heuristic is that double-quoting is unnecessary unless the string
784 contains an apostrophe, a comma, or backslash (other than
785 backslash-backslash). YYSTR is taken from yytname. If YYRES is
786 null, do not copy; instead, return the length of what the result
789 yytnamerr (char *yyres
, const char *yystr
)
794 char const *yyp
= yystr
;
801 goto do_not_strip_quotes
;
805 goto do_not_strip_quotes
;
818 do_not_strip_quotes
: ;
822 return yystrlen (yystr
);
824 return yystpcpy (yyres
, yystr
) - yyres
;
828 /* Copy into YYRESULT an error message about the unexpected token
829 YYCHAR while in state YYSTATE. Return the number of bytes copied,
830 including the terminating null byte. If YYRESULT is null, do not
831 copy anything; just return the number of bytes that would be
832 copied. As a special case, return 0 if an ordinary "syntax error"
833 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
836 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
838 int yyn
= yypact
[yystate
];
840 if (! (YYPACT_NINF
< yyn
&& yyn
< YYLAST
))
844 int yytype
= YYTRANSLATE (yychar
);
845 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
846 YYSIZE_T yysize
= yysize0
;
848 int yysize_overflow
= 0;
849 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
850 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
854 /* This is so xgettext sees the translatable formats that are
855 constructed on the fly. */
856 YY_("syntax error, unexpected %s");
857 YY_("syntax error, unexpected %s, expecting %s");
858 YY_("syntax error, unexpected %s, expecting %s or %s");
859 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
860 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
864 static char const yyunexpected
[] = "syntax error, unexpected %s";
865 static char const yyexpecting
[] = ", expecting %s";
866 static char const yyor
[] = " or %s";
867 char yyformat
[sizeof yyunexpected
868 + sizeof yyexpecting
- 1
869 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
870 * (sizeof yyor
- 1))];
871 char const *yyprefix
= yyexpecting
;
873 /* Start YYX at -YYN if negative to avoid negative indexes in
875 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
877 /* Stay within bounds of both yycheck and yytname. */
878 int yychecklim
= YYLAST
- yyn
;
879 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
882 yyarg
[0] = yytname
[yytype
];
883 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
885 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
886 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
888 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
892 yyformat
[sizeof yyunexpected
- 1] = '\0';
895 yyarg
[yycount
++] = yytname
[yyx
];
896 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
897 yysize_overflow
|= yysize1
< yysize
;
899 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
904 yysize1
= yysize
+ yystrlen (yyf
);
905 yysize_overflow
|= yysize1
< yysize
;
909 return YYSIZE_MAXIMUM
;
913 /* Avoid sprintf, as that infringes on the user's name space.
914 Don't have undefined behavior even if the translation
915 produced a string with the wrong number of "%s"s. */
916 char *yyp
= yyresult
;
918 while ((*yyp
= *yyf
))
920 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
922 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
935 #endif /* YYERROR_VERBOSE */
938 ]b4_yydestruct_generate([b4_c_function_def
])[
941 /* Prevent warnings from -Wmissing-prototypes. */
945 int yyparse (void *YYPARSE_PARAM
);
949 #else /* ! YYPARSE_PARAM */
950 ]b4_c_function_decl([yyparse
], [int], b4_parse_param
)[
951 #endif /* ! YYPARSE_PARAM */
954 ]m4_divert_push([KILL
])# ======================== M4 code.
955 # b4_declare_parser_variables
956 # ---------------------------
957 # Declare the variables that are global, or local to YYPARSE if
959 m4_define([b4_declare_parser_variables
],
960 [/* The look-ahead symbol. */
963 /* The semantic value of the look-ahead symbol. */
966 /* Number of syntax errors so far. */
967 int yynerrs
;b4_location_if([
968 /* Location data for the look-ahead symbol. */
971 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
974 [b4_declare_parser_variables
])
983 int yyparse (void *YYPARSE_PARAM
)
985 int yyparse (YYPARSE_PARAM
)
988 #else /* ! YYPARSE_PARAM */
989 b4_c_function_def([yyparse
], [int], b4_parse_param
)
992 ]b4_pure_if([b4_declare_parser_variables
])[
996 /* Number of tokens to shift before error messages enabled. */
998 /* Look-ahead token as an internal (translated) token number. */
1001 /* Buffer for error messages, and its allocated size. */
1003 char *yymsg
= yymsgbuf
;
1004 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1007 /* Three stacks and their tools:
1008 `yyss': related to states,
1009 `yyvs': related to semantic values,
1010 `yyls': related to locations.
1012 Refer to the stacks thru separate pointers, to allow yyoverflow
1013 to reallocate them elsewhere. */
1015 /* The state stack. */
1016 short int yyssa
[YYINITDEPTH
];
1017 short int *yyss
= yyssa
;
1020 /* The semantic value stack. */
1021 YYSTYPE yyvsa
[YYINITDEPTH
];
1022 YYSTYPE
*yyvs
= yyvsa
;
1026 [[ /* The location stack. */
1027 YYLTYPE yylsa
[YYINITDEPTH
];
1028 YYLTYPE
*yyls
= yylsa
;
1030 /* The locations where the error started and ended. */
1031 YYLTYPE yyerror_range
[2];]])[
1033 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
1035 YYSIZE_T yystacksize
= YYINITDEPTH
;
1037 /* The variables used to return semantic value and location from the
1040 ]b4_location_if([ YYLTYPE yyloc
;])[
1042 /* When reducing, the number of symbols on the RHS of the reduced
1046 YYDPRINTF ((stderr
, "Starting parse\n"));
1051 yychar
= YYEMPTY
; /* Cause a token to be read. */
1053 /* Initialize stack pointers.
1054 Waste one element of value and location stack
1055 so that they stay on the same level as the state stack.
1056 The wasted elements are never initialized. */
1060 ]b4_location_if([[ yylsp
= yyls
;
1061 #if YYLTYPE_IS_TRIVIAL
1062 /* Initialize the default location before parsing starts. */
1063 yylloc
.first_line
= yylloc
.last_line
= 1;
1064 yylloc
.first_column
= yylloc
.last_column
= 0;
1067 m4_ifdef([b4_initial_action
], [
1068 m4_pushdef([b4_at_dollar
], [m4_define([b4_at_dollar_used
])yylloc
])dnl
1069 m4_pushdef([b4_dollar_dollar
], [m4_define([b4_dollar_dollar_used
])yylval
])dnl
1070 /* User initialization code. */
1072 m4_popdef([b4_dollar_dollar
])dnl
1073 m4_popdef([b4_at_dollar
])dnl
1074 /* Line __line__ of yacc.c. */
1075 b4_syncline([@oline@
], [@ofile@
])
1077 m4_ifdef([b4_dollar_dollar_used
],[[ yyvsp
[0] = yylval
;
1079 m4_ifdef([b4_at_dollar_used
], [[ yylsp
[0] = yylloc
;
1083 /*------------------------------------------------------------.
1084 | yynewstate -- Push a new state, which is found in yystate. |
1085 `------------------------------------------------------------*/
1087 /* In all cases, when you get here, the value and location stacks
1088 have just been pushed. so pushing a state here evens the stacks.
1095 if (yyss
+ yystacksize
- 1 <= yyssp
)
1097 /* Get the current used size of the three stacks, in elements. */
1098 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1102 /* Give user a chance to reallocate the stack. Use copies of
1103 these so that the &'s don't force the real ones into
1105 YYSTYPE
*yyvs1
= yyvs
;
1106 short int *yyss1
= yyss
;
1107 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
1109 /* Each stack pointer address is followed by the size of the
1110 data in use in that stack, in bytes. This used to be a
1111 conditional around just the two extra args, but that might
1112 be undefined if yyoverflow is a macro. */
1113 yyoverflow (YY_("memory exhausted"),
1114 &yyss1
, yysize
* sizeof (*yyssp
),
1115 &yyvs1
, yysize
* sizeof (*yyvsp
),
1116 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
1118 ]b4_location_if([ yyls
= yyls1
;])[
1122 #else /* no yyoverflow */
1123 # ifndef YYSTACK_RELOCATE
1124 goto yyexhaustedlab
;
1126 /* Extend the stack our own way. */
1127 if (YYMAXDEPTH
<= yystacksize
)
1128 goto yyexhaustedlab
;
1130 if (YYMAXDEPTH
< yystacksize
)
1131 yystacksize
= YYMAXDEPTH
;
1134 short int *yyss1
= yyss
;
1135 union yyalloc
*yyptr
=
1136 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1138 goto yyexhaustedlab
;
1139 YYSTACK_RELOCATE (yyss
);
1140 YYSTACK_RELOCATE (yyvs
);
1141 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
1142 # undef YYSTACK_RELOCATE
1144 YYSTACK_FREE (yyss1
);
1147 #endif /* no yyoverflow */
1149 yyssp
= yyss
+ yysize
- 1;
1150 yyvsp
= yyvs
+ yysize
- 1;
1151 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
1153 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1154 (unsigned long int) yystacksize
));
1156 if (yyss
+ yystacksize
- 1 <= yyssp
)
1160 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1169 /* Do appropriate processing given the current state. */
1170 /* Read a look-ahead token if we need one and don't already have one. */
1173 /* First try to decide what to do without reference to look-ahead token. */
1175 yyn
= yypact
[yystate
];
1176 if (yyn
== YYPACT_NINF
)
1179 /* Not known => get a look-ahead token if don't already have one. */
1181 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1182 if (yychar
== YYEMPTY
)
1184 YYDPRINTF ((stderr
, "Reading a token: "));
1188 if (yychar
<= YYEOF
)
1190 yychar
= yytoken
= YYEOF
;
1191 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1195 yytoken
= YYTRANSLATE (yychar
);
1196 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1199 /* If the proper action on seeing token YYTOKEN is to reduce or to
1200 detect an error, take that action. */
1202 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1207 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1216 /* Shift the look-ahead token. */
1217 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1219 /* Discard the token being shifted unless it is eof. */
1220 if (yychar
!= YYEOF
)
1224 ]b4_location_if([ *++yylsp
= yylloc
;])[
1226 /* Count tokens shifted since error; after three, turn off error
1235 /*-----------------------------------------------------------.
1236 | yydefault -- do the default action for the current state. |
1237 `-----------------------------------------------------------*/
1239 yyn
= yydefact
[yystate
];
1245 /*-----------------------------.
1246 | yyreduce -- Do a reduction. |
1247 `-----------------------------*/
1249 /* yyn is the number of a rule to reduce with. */
1252 /* If YYLEN is nonzero, implement the default value of the action:
1255 Otherwise, the following line sets YYVAL to garbage.
1256 This behavior is undocumented and Bison
1257 users should not rely upon it. Assigning to YYVAL
1258 unconditionally makes the parser a bit smaller, and it avoids a
1259 GCC warning that YYVAL may be used uninitialized. */
1260 yyval
= yyvsp
[1-yylen
];
1263 [[ /* Default location. */
1264 YYLLOC_DEFAULT (yyloc
, yylsp
- yylen
, yylen
);]])[
1265 YY_REDUCE_PRINT (yyn
);
1271 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
1273 /* Line __line__ of yacc.c. */
1274 ]b4_syncline([@oline@
], [@ofile@
])[
1278 ]b4_location_if([ yylsp
-= yylen
;])[
1280 YY_STACK_PRINT (yyss
, yyssp
);
1283 ]b4_location_if([ *++yylsp
= yyloc
;])[
1285 /* Now `shift' the result of the reduction. Determine what state
1286 that goes to, based on the state we popped back to and the rule
1287 number reduced by. */
1291 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1292 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1293 yystate
= yytable
[yystate
];
1295 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1300 /*------------------------------------.
1301 | yyerrlab -- here on detecting error |
1302 `------------------------------------*/
1304 /* If not already recovering from an error, report this error. */
1308 #if ! YYERROR_VERBOSE
1309 yyerror (]b4_yyerror_args
[YY_("syntax error"));
1312 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
1313 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
1315 YYSIZE_T yyalloc
= 2 * yysize
;
1316 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
1317 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
1318 if (yymsg
!= yymsgbuf
)
1319 YYSTACK_FREE (yymsg
);
1320 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
1322 yymsg_alloc
= yyalloc
;
1326 yymsg_alloc
= sizeof yymsgbuf
;
1330 if (0 < yysize
&& yysize
<= yymsg_alloc
)
1332 (void) yysyntax_error (yymsg
, yystate
, yychar
);
1333 yyerror (]b4_yyerror_args
[yymsg
);
1337 yyerror (]b4_yyerror_args
[YY_("syntax error"));
1339 goto yyexhaustedlab
;
1345 ]b4_location_if([[ yyerror_range
[0] = yylloc
;]])[
1347 if (yyerrstatus
== 3)
1349 /* If just tried and failed to reuse look-ahead token after an
1350 error, discard it. */
1352 if (yychar
<= YYEOF
)
1354 /* Return failure if at end of input. */
1355 if (yychar
== YYEOF
)
1360 yydestruct ("Error: discarding",
1361 yytoken
, &yylval
]b4_location_if([, &yylloc
])[]b4_user_args
[);
1366 /* Else will try to reuse look-ahead token after shifting the error
1371 /*---------------------------------------------------.
1372 | yyerrorlab -- error raised explicitly by YYERROR. |
1373 `---------------------------------------------------*/
1376 /* Pacify compilers like GCC when the user code never invokes
1377 YYERROR and the label yyerrorlab therefore never appears in user
1379 if (/*CONSTCOND*/ 0)
1382 ]b4_location_if([[ yyerror_range
[0] = yylsp
[1-yylen
];
1390 /*-------------------------------------------------------------.
1391 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1392 `-------------------------------------------------------------*/
1394 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1398 yyn
= yypact
[yystate
];
1399 if (yyn
!= YYPACT_NINF
)
1402 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1410 /* Pop the current state because it cannot handle the error token. */
1414 ]b4_location_if([[ yyerror_range
[0] = *yylsp
;]])[
1415 yydestruct ("Error: popping",
1416 yystos
[yystate
], yyvsp
]b4_location_if([, yylsp
])[]b4_user_args
[);
1419 YY_STACK_PRINT (yyss
, yyssp
);
1427 yyerror_range
[1] = yylloc
;
1428 /* Using YYLLOC is tempting, but would change the location of
1429 the look-ahead. YYLOC is available though. */
1430 YYLLOC_DEFAULT (yyloc
, yyerror_range
- 1, 2);
1431 *++yylsp
= yyloc
;]])[
1433 /* Shift the error token. */
1434 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1440 /*-------------------------------------.
1441 | yyacceptlab -- YYACCEPT comes here. |
1442 `-------------------------------------*/
1447 /*-----------------------------------.
1448 | yyabortlab -- YYABORT comes here. |
1449 `-----------------------------------*/
1455 /*-------------------------------------------------.
1456 | yyexhaustedlab -- memory exhaustion comes here. |
1457 `-------------------------------------------------*/
1459 yyerror (]b4_yyerror_args
[YY_("memory exhausted"));
1465 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
1466 yydestruct ("Cleanup: discarding lookahead",
1467 yytoken
, &yylval
]b4_location_if([, &yylloc
])[]b4_user_args
[);
1468 while (yyssp
!= yyss
)
1470 yydestruct ("Cleanup: popping",
1471 yystos
[*yyssp
], yyvsp
]b4_location_if([, yylsp
])[]b4_user_args
[);
1476 YYSTACK_FREE (yyss
);
1479 if (yymsg
!= yymsgbuf
)
1480 YYSTACK_FREE (yymsg
);
1487 m4_if(b4_defines_flag
, 0, [],
1488 [@output @output_header_name@
1489 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1490 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])
1492 /* As a special exception, when this file is copied by Bison into a
1493 Bison output file, you may use that output file without restriction.
1494 This special exception was added by the Free Software Foundation
1495 in version 1.24 of Bison. */
1497 b4_token_enums_defines(b4_tokens
)
1499 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1500 m4_ifdef([b4_stype
],
1501 [b4_syncline([b4_stype_line
], [b4_file_name
])
1502 typedef union m4_bregexp(b4_stype
, [^{], [YYSTYPE
])b4_stype YYSTYPE
;
1503 /* Line __line__ of yacc.c. */
1504 b4_syncline([@oline@
], [@ofile@
])],
1505 [typedef int YYSTYPE
;])
1506 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1507 # define YYSTYPE_IS_DECLARED 1
1508 # define YYSTYPE_IS_TRIVIAL 1
1512 [extern YYSTYPE b4_prefix
[]lval
;])
1515 [#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
1516 typedef struct YYLTYPE
1523 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
1524 # define YYLTYPE_IS_DECLARED 1
1525 # define YYLTYPE_IS_TRIVIAL 1
1529 [extern YYLTYPE b4_prefix
[]lloc
;])