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_pure_if(IF-TRUE, IF-FALSE)
40 # -----------------------------
41 # Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
42 m4_define([b4_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_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@
{m4_eval([$
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@
{m4_eval([$
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 file is copied by Bison into a
141 Bison output file, you may use that output file without restriction.
142 This special exception was added by the Free Software Foundation
143 in version 1.24 of Bison. */
145 /* Written by Richard Stallman by simplifying the original so called
146 ``semantic'' parser. */
148 /* All symbols defined below should begin with yy or YY, to avoid
149 infringing on user name space. This should be done even for local
150 variables, as they might otherwise be expanded by user macros.
151 There are some unavoidable exceptions within include files to
152 define necessary library symbols; they are noted "INFRINGES ON
153 USER NAME SPACE" below. */
156 m4_if(b4_prefix
[], [yy
], [],
157 [/* Substitute the variable and function names. */
158 #define yyparse b4_prefix[]parse
159 #define yylex b4_prefix[]lex
160 #define yyerror b4_prefix[]error
161 #define yylval b4_prefix[]lval
162 #define yychar b4_prefix[]char
163 #define yydebug b4_prefix[]debug
164 #define yynerrs b4_prefix[]nerrs
165 b4_location_if([#define yylloc b4_prefix[]lloc])])[
167 ]b4_token_enums_defines(b4_tokens
)[
169 /* Copy the first part of user declarations. */
172 /* Enabling traces. */
174 # define YYDEBUG ]b4_debug[
177 /* Enabling verbose error messages. */
178 #ifdef YYERROR_VERBOSE
179 # undef YYERROR_VERBOSE
180 # define YYERROR_VERBOSE 1
182 # define YYERROR_VERBOSE ]b4_error_verbose[
185 /* Enabling the token table. */
186 #ifndef YYTOKEN_TABLE
187 # define YYTOKEN_TABLE ]b4_token_table[
190 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
191 ]m4_ifdef([b4_stype
],
192 [b4_syncline([b4_stype_line
], [b4_file_name
])
193 typedef union m4_bregexp(b4_stype
, [^{], [YYSTYPE
])b4_stype YYSTYPE
;
194 /* Line __line__ of yacc.c. */
195 b4_syncline([@oline@
], [@ofile@
])],
196 [typedef int YYSTYPE
;])[
197 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
198 # define YYSTYPE_IS_DECLARED 1
199 # define YYSTYPE_IS_TRIVIAL 1
202 ]b4_location_if([#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
203 typedef struct YYLTYPE
210 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
211 # define YYLTYPE_IS_DECLARED 1
212 # define YYLTYPE_IS_TRIVIAL 1
216 /* Copy the second part of user declarations. */
219 /* Line __line__ of yacc.c. */
220 b4_syncline([@oline@
], [@ofile@
])[
222 /* Define YYMODERN_C if this compiler supports C89 or better. Some
223 modern compilers (e.g., IBM xlc 7.0) don't define __STDC__ for
224 pedantic reasons, but they define __STDC_VERSION__ so check that
225 as well. Consider a C++ compiler to be modern if it defines
227 #if defined (__STDC__) || defined (__STDC_VERSION__) || defined (__cplusplus)
228 # define YYMODERN_C 1
230 # define YYMODERN_C 0
234 # if defined (__SIZE_TYPE__)
235 # define YYSIZE_T __SIZE_TYPE__
236 # elif defined (size_t)
237 # define YYSIZE_T size_t
238 # elif ! defined (YYSIZE_T) && YYMODERN_C
239 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
240 # define YYSIZE_T size_t
242 # define YYSIZE_T unsigned int
246 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
251 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
252 # define YY_(msgid) dgettext ("bison-runtime", msgid)
256 # define YY_(msgid) msgid
260 /* Suppress unused-variable warnings by "using" E. */
261 #define YYUSE(e) do {;} while (/*CONSTCOND*/ 0 && (e))
263 #if ! defined (yyoverflow) || YYERROR_VERBOSE
265 /* The parser invokes alloca or malloc; define the necessary symbols. */
267 # ifdef YYSTACK_USE_ALLOCA
268 # if YYSTACK_USE_ALLOCA
270 # define YYSTACK_ALLOC __builtin_alloca
271 # elif defined (__BUILTIN_VA_ARG_INCR)
272 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
273 # elif defined (_AIX)
274 # define YYSTACK_ALLOC __alloca
275 # elif defined (_MSC_VER)
276 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
277 # define alloca _alloca
279 # define YYSTACK_ALLOC alloca
280 # if ! defined (_ALLOCA_H) && ! defined (_STDLIB_H) && YYMODERN_C
281 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
290 # ifdef YYSTACK_ALLOC
291 /* Pacify GCC's `empty if-body' warning. */
292 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
293 # ifndef YYSTACK_ALLOC_MAXIMUM
294 /* The OS might guarantee only one guard page at the bottom of the stack,
295 and a page size can be as small as 4096 bytes. So we cannot safely
296 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
297 to allow for a few compiler-allocated temporary stack slots. */
298 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
301 # define YYSTACK_ALLOC YYMALLOC
302 # define YYSTACK_FREE YYFREE
303 # ifndef YYSTACK_ALLOC_MAXIMUM
304 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
310 # define YYMALLOC malloc
311 # if ! defined (malloc) && ! defined (_STDLIB_H) && YYMODERN_C
312 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
317 # if ! defined (free) && ! defined (_STDLIB_H) && YYMODERN_C
318 void free (void *); /* INFRINGES ON USER NAME SPACE */
325 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
328 #if (! defined (yyoverflow) \
329 && (! defined (__cplusplus) \
330 || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
331 && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
333 /* A type that is properly aligned for any stack member. */
338 ]b4_location_if([ YYLTYPE yyls
;
342 /* The size of the maximum gap between one aligned stack and the next. */
343 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
345 /* The size of an array large to enough to hold all stacks, each with
348 [# define YYSTACK_BYTES(N) \
349 ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
350 + 2 * YYSTACK_GAP_MAXIMUM)],
351 [# define YYSTACK_BYTES(N) \
352 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
353 + YYSTACK_GAP_MAXIMUM)])[
355 /* Copy COUNT objects from FROM to TO. The source and destination do
358 # if defined (__GNUC__) && 1 < __GNUC__
359 # define YYCOPY(To, From, Count) \
360 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
362 # define YYCOPY(To, From, Count) \
366 for (yyi = 0; yyi < (Count); yyi++) \
367 (To)[yyi] = (From)[yyi]; \
369 while (/*CONSTCOND*/ 0)
373 /* Relocate STACK from its old location to the new one. The
374 local variables YYSIZE and YYSTACKSIZE give the old and new number of
375 elements in the stack, and YYPTR gives the new location of the
376 stack. Advance YYPTR to a properly aligned location for the next
378 # define YYSTACK_RELOCATE(Stack) \
381 YYSIZE_T yynewbytes; \
382 YYCOPY (&yyptr->Stack, Stack, yysize); \
383 Stack = &yyptr->Stack; \
384 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
385 yyptr += yynewbytes / sizeof (*yyptr); \
387 while (/*CONSTCOND*/ 0)
392 typedef signed char yysigned_char
;
394 typedef short int yysigned_char
;
397 /* YYFINAL -- State number of the termination state. */
398 #define YYFINAL ]b4_final_state_number[
399 /* YYLAST -- Last index in YYTABLE. */
400 #define YYLAST ]b4_last[
402 /* YYNTOKENS -- Number of terminals. */
403 #define YYNTOKENS ]b4_tokens_number[
404 /* YYNNTS -- Number of nonterminals. */
405 #define YYNNTS ]b4_nterms_number[
406 /* YYNRULES -- Number of rules. */
407 #define YYNRULES ]b4_rules_number[
408 /* YYNRULES -- Number of states. */
409 #define YYNSTATES ]b4_states_number[
411 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
412 #define YYUNDEFTOK ]b4_undef_token_number[
413 #define YYMAXUTOK ]b4_user_token_number_max[
415 #define YYTRANSLATE(YYX) \
416 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
418 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
419 static const ]b4_int_type_for([b4_translate
])[ yytranslate
[] =
425 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
427 static const ]b4_int_type_for([b4_prhs
])[ yyprhs
[] =
432 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
433 static const ]b4_int_type_for([b4_rhs
])[ yyrhs
[] =
438 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
439 static const ]b4_int_type_for([b4_rline
])[ yyrline
[] =
445 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
446 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
447 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
448 static const char *const yytname
[] =
455 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
457 static const ]b4_int_type_for([b4_toknum
])[ yytoknum
[] =
463 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
464 static const ]b4_int_type_for([b4_r1
])[ yyr1
[] =
469 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
470 static const ]b4_int_type_for([b4_r2
])[ yyr2
[] =
475 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
476 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
477 means the default is an error. */
478 static const ]b4_int_type_for([b4_defact
])[ yydefact
[] =
483 /* YYDEFGOTO[NTERM-NUM]. */
484 static const ]b4_int_type_for([b4_defgoto
])[ yydefgoto
[] =
489 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
491 #define YYPACT_NINF ]b4_pact_ninf[
492 static const ]b4_int_type_for([b4_pact
])[ yypact
[] =
497 /* YYPGOTO[NTERM-NUM]. */
498 static const ]b4_int_type_for([b4_pgoto
])[ yypgoto
[] =
503 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
504 positive, shift that token. If negative, reduce the rule which
505 number is the opposite. If zero, do what YYDEFACT says.
506 If YYTABLE_NINF, syntax error. */
507 #define YYTABLE_NINF ]b4_table_ninf[
508 static const ]b4_int_type_for([b4_table
])[ yytable
[] =
513 static const ]b4_int_type_for([b4_check
])[ yycheck
[] =
518 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
519 symbol of state STATE-NUM. */
520 static const ]b4_int_type_for([b4_stos
])[ yystos
[] =
525 #define yyerrok (yyerrstatus = 0)
526 #define yyclearin (yychar = YYEMPTY)
530 #define YYACCEPT goto yyacceptlab
531 #define YYABORT goto yyabortlab
532 #define YYERROR goto yyerrorlab
535 /* Like YYERROR except do call yyerror. This remains here temporarily
536 to ease the transition to the new meaning of YYERROR, for GCC.
537 Once GCC version 2 has supplanted version 1, this can go. */
539 #define YYFAIL goto yyerrlab
541 #define YYRECOVERING() (!!yyerrstatus)
543 #define YYBACKUP(Token, Value) \
545 if (yychar == YYEMPTY && yylen == 1) \
549 yytoken = YYTRANSLATE (yychar); \
555 yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
558 while (/*CONSTCOND*/ 0)
562 #define YYERRCODE 256
565 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
566 If N is 0, then set CURRENT to the empty location which ends
567 the previous symbol: RHS[0] (always defined). */
569 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
570 #ifndef YYLLOC_DEFAULT
571 # define YYLLOC_DEFAULT(Current, Rhs, N) \
575 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
576 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
577 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
578 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
582 (Current).first_line = (Current).last_line = \
583 YYRHSLOC (Rhs, 0).last_line; \
584 (Current).first_column = (Current).last_column = \
585 YYRHSLOC (Rhs, 0).last_column; \
587 while (/*CONSTCOND*/ 0)
591 /* YY_LOCATION_PRINT -- Print the location on the stream.
592 This macro was not mandated originally: define only if we know
593 we won't break user code: when these are the locations we know. */
595 #ifndef YY_LOCATION_PRINT
596 # if YYLTYPE_IS_TRIVIAL
597 # define YY_LOCATION_PRINT(File, Loc) \
598 fprintf (File, "%d.%d-%d.%d", \
599 (Loc).first_line, (Loc).first_column, \
600 (Loc).last_line, (Loc).last_column)
602 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
607 /* YYLEX -- calling `yylex' with the right arguments. */
610 # define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM)
612 # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
615 /* Enable debugging if requested. */
619 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
620 # define YYFPRINTF fprintf
623 # define YYDPRINTF(Args) \
627 } while (/*CONSTCOND*/ 0)
629 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
633 YYFPRINTF (stderr, "%s ", Title); \
634 yysymprint (stderr, \
635 Type, Value]b4_location_if([, Location])[); \
636 YYFPRINTF (stderr, "\n"); \
638 } while (/*CONSTCOND*/ 0)
640 /*------------------------------------------------------------------.
641 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
643 `------------------------------------------------------------------*/
645 ]b4_c_function_def([yy_stack_print
], [static void],
646 [[short int *bottom
], [bottom
]],
647 [[short int *top
], [top
]])[
649 YYFPRINTF (stderr
, "Stack now");
650 for (/* Nothing. */; bottom
<= top
; ++bottom
)
651 YYFPRINTF (stderr
, " %d", *bottom
);
652 YYFPRINTF (stderr
, "\n");
655 # define YY_STACK_PRINT(Bottom, Top) \
658 yy_stack_print ((Bottom), (Top)); \
659 } while (/*CONSTCOND*/ 0)
662 /*------------------------------------------------.
663 | Report that the YYRULE is going to be reduced. |
664 `------------------------------------------------*/
666 ]b4_c_function_def([yy_reduce_print
], [static void],
667 [[int yyrule
], [yyrule
]])[
670 unsigned long int yylno
= yyrline
[yyrule
];
671 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu), ",
673 /* Print the symbols being reduced, and their result. */
674 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
675 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
676 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
679 # define YY_REDUCE_PRINT(Rule) \
682 yy_reduce_print (Rule); \
683 } while (/*CONSTCOND*/ 0)
685 /* Nonzero means print parse trace. It is left uninitialized so that
686 multiple parsers can coexist. */
689 # define YYDPRINTF(Args)
690 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
691 # define YY_STACK_PRINT(Bottom, Top)
692 # define YY_REDUCE_PRINT(Rule)
693 #endif /* !YYDEBUG */
696 /* YYINITDEPTH -- initial size of the parser's stacks. */
698 # define YYINITDEPTH ]b4_stack_depth_init[
701 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
702 if the built-in stack extension method is used).
704 Do not make this value too large; the results are undefined if
705 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
706 evaluated with infinite-precision integer arithmetic. */
709 # define YYMAXDEPTH ]b4_stack_depth_max[
717 # if defined (__GLIBC__) && defined (_STRING_H)
718 # define yystrlen strlen
720 /* Return the length of YYSTR. */
723 yystrlen (const char *yystr
)
729 const char *yys
= yystr
;
731 while (*yys
++ != '\0')
734 return yys
- yystr
- 1;
740 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
741 # define yystpcpy stpcpy
743 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
747 yystpcpy (char *yydest
, const char *yysrc
)
749 yystpcpy (yydest
, yysrc
)
755 const char *yys
= yysrc
;
757 while ((*yyd
++ = *yys
++) != '\0')
766 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
767 quotes and backslashes, so that it's suitable for yyerror. The
768 heuristic is that double-quoting is unnecessary unless the string
769 contains an apostrophe, a comma, or backslash (other than
770 backslash-backslash). YYSTR is taken from yytname. If YYRES is
771 null, do not copy; instead, return the length of what the result
774 yytnamerr (char *yyres
, const char *yystr
)
779 char const *yyp
= yystr
;
786 goto do_not_strip_quotes
;
790 goto do_not_strip_quotes
;
803 do_not_strip_quotes
: ;
807 return yystrlen (yystr
);
809 return yystpcpy (yyres
, yystr
) - yyres
;
813 /* Copy into YYRESULT an error message about the unexpected token
814 YYCHAR while in state YYSTATE. Return the number of bytes copied,
815 including the terminating null byte. If YYRESULT is null, do not
816 copy anything; just return the number of bytes that would be
817 copied. As a special case, return 0 if an ordinary "syntax error"
818 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
821 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
823 int yyn
= yypact
[yystate
];
825 if (! (YYPACT_NINF
< yyn
&& yyn
< YYLAST
))
829 int yytype
= YYTRANSLATE (yychar
);
830 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
831 YYSIZE_T yysize
= yysize0
;
833 int yysize_overflow
= 0;
834 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
835 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
839 /* This is so xgettext sees the translatable formats that are
840 constructed on the fly. */
841 YY_("syntax error, unexpected %s");
842 YY_("syntax error, unexpected %s, expecting %s");
843 YY_("syntax error, unexpected %s, expecting %s or %s");
844 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
845 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
849 static char const yyunexpected
[] = "syntax error, unexpected %s";
850 static char const yyexpecting
[] = ", expecting %s";
851 static char const yyor
[] = " or %s";
852 char yyformat
[sizeof yyunexpected
853 + sizeof yyexpecting
- 1
854 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
855 * (sizeof yyor
- 1))];
856 char const *yyprefix
= yyexpecting
;
858 /* Start YYX at -YYN if negative to avoid negative indexes in
860 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
862 /* Stay within bounds of both yycheck and yytname. */
863 int yychecklim
= YYLAST
- yyn
;
864 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
867 yyarg
[0] = yytname
[yytype
];
868 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
870 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
871 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
873 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
877 yyformat
[sizeof yyunexpected
- 1] = '\0';
880 yyarg
[yycount
++] = yytname
[yyx
];
881 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
882 yysize_overflow
|= yysize1
< yysize
;
884 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
889 yysize1
= yysize
+ yystrlen (yyf
);
890 yysize_overflow
|= yysize1
< yysize
;
894 return YYSIZE_MAXIMUM
;
898 /* Avoid sprintf, as that infringes on the user's name space.
899 Don't have undefined behavior even if the translation
900 produced a string with the wrong number of "%s"s. */
901 char *yyp
= yyresult
;
903 while ((*yyp
= *yyf
))
905 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
907 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
920 #endif /* YYERROR_VERBOSE */
924 ]b4_yysymprint_generate([b4_c_function_def
])[
925 #endif /* ! YYDEBUG */
926 ]b4_yydestruct_generate([b4_c_function_def
])
929 /* Prevent warnings from -Wmissing-prototypes. */
933 int yyparse (void *YYPARSE_PARAM
);
937 #else /* ! YYPARSE_PARAM */
938 b4_c_function_decl([yyparse
], [int], b4_parse_param
)
939 #endif /* ! YYPARSE_PARAM */
942 m4_divert_push([KILL
])# ======================== M4 code.
943 # b4_declare_parser_variables
944 # ---------------------------
945 # Declare the variables that are global, or local to YYPARSE if
947 m4_define([b4_declare_parser_variables
],
948 [/* The look-ahead symbol. */
951 /* The semantic value of the look-ahead symbol. */
954 /* Number of syntax errors so far. */
955 int yynerrs
;b4_location_if([
956 /* Location data for the look-ahead symbol. */
959 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
962 [b4_declare_parser_variables
])
971 int yyparse (void *YYPARSE_PARAM
)
973 int yyparse (YYPARSE_PARAM
)
976 #else /* ! YYPARSE_PARAM */
977 b4_c_function_def([yyparse
], [int], b4_parse_param
)
980 ]b4_pure_if([b4_declare_parser_variables
])[
984 /* Number of tokens to shift before error messages enabled. */
986 /* Look-ahead token as an internal (translated) token number. */
989 /* Buffer for error messages, and its allocated size. */
991 char *yymsg
= yymsgbuf
;
992 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
995 /* Three stacks and their tools:
996 `yyss': related to states,
997 `yyvs': related to semantic values,
998 `yyls': related to locations.
1000 Refer to the stacks thru separate pointers, to allow yyoverflow
1001 to reallocate them elsewhere. */
1003 /* The state stack. */
1004 short int yyssa
[YYINITDEPTH
];
1005 short int *yyss
= yyssa
;
1008 /* The semantic value stack. */
1009 YYSTYPE yyvsa
[YYINITDEPTH
];
1010 YYSTYPE
*yyvs
= yyvsa
;
1014 [[ /* The location stack. */
1015 YYLTYPE yylsa
[YYINITDEPTH
];
1016 YYLTYPE
*yyls
= yylsa
;
1018 /* The locations where the error started and ended. */
1019 YYLTYPE yyerror_range
[2];]])[
1021 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
1023 YYSIZE_T yystacksize
= YYINITDEPTH
;
1025 /* The variables used to return semantic value and location from the
1028 ]b4_location_if([ YYLTYPE yyloc
;])[
1030 /* When reducing, the number of symbols on the RHS of the reduced
1034 YYDPRINTF ((stderr
, "Starting parse\n"));
1039 yychar
= YYEMPTY
; /* Cause a token to be read. */
1041 /* Initialize stack pointers.
1042 Waste one element of value and location stack
1043 so that they stay on the same level as the state stack.
1044 The wasted elements are never initialized. */
1048 ]b4_location_if([[ yylsp
= yyls
;
1049 #if YYLTYPE_IS_TRIVIAL
1050 /* Initialize the default location before parsing starts. */
1051 yylloc
.first_line
= yylloc
.last_line
= 1;
1052 yylloc
.first_column
= yylloc
.last_column
= 0;
1055 m4_ifdef([b4_initial_action
], [
1056 m4_pushdef([b4_at_dollar
], [m4_define([b4_at_dollar_used
])yylloc
])dnl
1057 m4_pushdef([b4_dollar_dollar
], [m4_define([b4_dollar_dollar_used
])yylval
])dnl
1058 /* User initialization code. */
1060 m4_popdef([b4_dollar_dollar
])dnl
1061 m4_popdef([b4_at_dollar
])dnl
1062 /* Line __line__ of yacc.c. */
1063 b4_syncline([@oline@
], [@ofile@
])
1065 m4_ifdef([b4_dollar_dollar_used
],[[ yyvsp
[0] = yylval
;
1067 m4_ifdef([b4_at_dollar_used
], [[ yylsp
[0] = yylloc
;
1071 /*------------------------------------------------------------.
1072 | yynewstate -- Push a new state, which is found in yystate. |
1073 `------------------------------------------------------------*/
1075 /* In all cases, when you get here, the value and location stacks
1076 have just been pushed. so pushing a state here evens the stacks.
1083 if (yyss
+ yystacksize
- 1 <= yyssp
)
1085 /* Get the current used size of the three stacks, in elements. */
1086 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1090 /* Give user a chance to reallocate the stack. Use copies of
1091 these so that the &'s don't force the real ones into
1093 YYSTYPE
*yyvs1
= yyvs
;
1094 short int *yyss1
= yyss
;
1095 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
1097 /* Each stack pointer address is followed by the size of the
1098 data in use in that stack, in bytes. This used to be a
1099 conditional around just the two extra args, but that might
1100 be undefined if yyoverflow is a macro. */
1101 yyoverflow (YY_("memory exhausted"),
1102 &yyss1
, yysize
* sizeof (*yyssp
),
1103 &yyvs1
, yysize
* sizeof (*yyvsp
),
1104 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
1106 ]b4_location_if([ yyls
= yyls1
;])[
1110 #else /* no yyoverflow */
1111 # ifndef YYSTACK_RELOCATE
1112 goto yyexhaustedlab
;
1114 /* Extend the stack our own way. */
1115 if (YYMAXDEPTH
<= yystacksize
)
1116 goto yyexhaustedlab
;
1118 if (YYMAXDEPTH
< yystacksize
)
1119 yystacksize
= YYMAXDEPTH
;
1122 short int *yyss1
= yyss
;
1123 union yyalloc
*yyptr
=
1124 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1126 goto yyexhaustedlab
;
1127 YYSTACK_RELOCATE (yyss
);
1128 YYSTACK_RELOCATE (yyvs
);
1129 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
1130 # undef YYSTACK_RELOCATE
1132 YYSTACK_FREE (yyss1
);
1135 #endif /* no yyoverflow */
1137 yyssp
= yyss
+ yysize
- 1;
1138 yyvsp
= yyvs
+ yysize
- 1;
1139 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
1141 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1142 (unsigned long int) yystacksize
));
1144 if (yyss
+ yystacksize
- 1 <= yyssp
)
1148 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1157 /* Do appropriate processing given the current state. */
1158 /* Read a look-ahead token if we need one and don't already have one. */
1161 /* First try to decide what to do without reference to look-ahead token. */
1163 yyn
= yypact
[yystate
];
1164 if (yyn
== YYPACT_NINF
)
1167 /* Not known => get a look-ahead token if don't already have one. */
1169 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1170 if (yychar
== YYEMPTY
)
1172 YYDPRINTF ((stderr
, "Reading a token: "));
1176 if (yychar
<= YYEOF
)
1178 yychar
= yytoken
= YYEOF
;
1179 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1183 yytoken
= YYTRANSLATE (yychar
);
1184 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1187 /* If the proper action on seeing token YYTOKEN is to reduce or to
1188 detect an error, take that action. */
1190 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1195 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1204 /* Shift the look-ahead token. */
1205 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1207 /* Discard the token being shifted unless it is eof. */
1208 if (yychar
!= YYEOF
)
1212 ]b4_location_if([ *++yylsp
= yylloc
;])[
1214 /* Count tokens shifted since error; after three, turn off error
1223 /*-----------------------------------------------------------.
1224 | yydefault -- do the default action for the current state. |
1225 `-----------------------------------------------------------*/
1227 yyn
= yydefact
[yystate
];
1233 /*-----------------------------.
1234 | yyreduce -- Do a reduction. |
1235 `-----------------------------*/
1237 /* yyn is the number of a rule to reduce with. */
1240 /* If YYLEN is nonzero, implement the default value of the action:
1243 Otherwise, the following line sets YYVAL to garbage.
1244 This behavior is undocumented and Bison
1245 users should not rely upon it. Assigning to YYVAL
1246 unconditionally makes the parser a bit smaller, and it avoids a
1247 GCC warning that YYVAL may be used uninitialized. */
1248 yyval
= yyvsp
[1-yylen
];
1251 [[ /* Default location. */
1252 YYLLOC_DEFAULT (yyloc
, yylsp
- yylen
, yylen
);]])[
1253 YY_REDUCE_PRINT (yyn
);
1260 /* Line __line__ of yacc.c. */
1261 b4_syncline([@oline@
], [@ofile@
])
1265 ]b4_location_if([ yylsp
-= yylen
;])[
1267 YY_STACK_PRINT (yyss
, yyssp
);
1270 ]b4_location_if([ *++yylsp
= yyloc
;])[
1272 /* Now `shift' the result of the reduction. Determine what state
1273 that goes to, based on the state we popped back to and the rule
1274 number reduced by. */
1278 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1279 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1280 yystate
= yytable
[yystate
];
1282 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1287 /*------------------------------------.
1288 | yyerrlab -- here on detecting error |
1289 `------------------------------------*/
1291 /* If not already recovering from an error, report this error. */
1295 #if ! YYERROR_VERBOSE
1296 yyerror (]b4_yyerror_args
[YY_("syntax error"));
1299 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
1300 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
1302 YYSIZE_T yyalloc
= 2 * yysize
;
1303 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
1304 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
1305 if (yymsg
!= yymsgbuf
)
1306 YYSTACK_FREE (yymsg
);
1307 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
1309 yymsg_alloc
= yyalloc
;
1313 yymsg_alloc
= sizeof yymsgbuf
;
1317 if (0 < yysize
&& yysize
<= yymsg_alloc
)
1319 (void) yysyntax_error (yymsg
, yystate
, yychar
);
1320 yyerror (]b4_yyerror_args
[yymsg
);
1324 yyerror (]b4_yyerror_args
[YY_("syntax error"));
1326 goto yyexhaustedlab
;
1332 ]b4_location_if([[ yyerror_range
[0] = yylloc
;]])[
1334 if (yyerrstatus
== 3)
1336 /* If just tried and failed to reuse look-ahead token after an
1337 error, discard it. */
1339 if (yychar
<= YYEOF
)
1341 /* Return failure if at end of input. */
1342 if (yychar
== YYEOF
)
1347 yydestruct ("Error: discarding", yytoken
, &yylval
]b4_location_if([, &yylloc
])[);
1352 /* Else will try to reuse look-ahead token after shifting the error
1357 /*---------------------------------------------------.
1358 | yyerrorlab -- error raised explicitly by YYERROR. |
1359 `---------------------------------------------------*/
1362 /* Pacify compilers like GCC when the user code never invokes
1363 YYERROR and the label yyerrorlab therefore never appears in user
1365 if (/*CONSTCOND*/ 0)
1368 ]b4_location_if([[ yyerror_range
[0] = yylsp
[1-yylen
];
1376 /*-------------------------------------------------------------.
1377 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1378 `-------------------------------------------------------------*/
1380 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1384 yyn
= yypact
[yystate
];
1385 if (yyn
!= YYPACT_NINF
)
1388 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1396 /* Pop the current state because it cannot handle the error token. */
1400 ]b4_location_if([[ yyerror_range
[0] = *yylsp
;]])[
1401 yydestruct ("Error: popping", yystos
[yystate
], yyvsp
]b4_location_if([, yylsp
])[);
1404 YY_STACK_PRINT (yyss
, yyssp
);
1412 yyerror_range
[1] = yylloc
;
1413 /* Using YYLLOC is tempting, but would change the location of
1414 the look-ahead. YYLOC is available though. */
1415 YYLLOC_DEFAULT (yyloc
, yyerror_range
- 1, 2);
1416 *++yylsp
= yyloc
;]])[
1418 /* Shift the error token. */
1419 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1425 /*-------------------------------------.
1426 | yyacceptlab -- YYACCEPT comes here. |
1427 `-------------------------------------*/
1432 /*-----------------------------------.
1433 | yyabortlab -- YYABORT comes here. |
1434 `-----------------------------------*/
1440 /*-------------------------------------------------.
1441 | yyexhaustedlab -- memory exhaustion comes here. |
1442 `-------------------------------------------------*/
1444 yyerror (]b4_yyerror_args
[YY_("memory exhausted"));
1450 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
1451 yydestruct ("Cleanup: discarding lookahead",
1452 yytoken
, &yylval
]b4_location_if([, &yylloc
])[);
1453 while (yyssp
!= yyss
)
1455 yydestruct ("Cleanup: popping",
1456 yystos
[*yyssp
], yyvsp
]b4_location_if([, yylsp
])[);
1461 YYSTACK_FREE (yyss
);
1464 if (yymsg
!= yymsgbuf
)
1465 YYSTACK_FREE (yymsg
);
1472 m4_if(b4_defines_flag
, 0, [],
1473 [@output @output_header_name@
1474 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1475 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])
1477 /* As a special exception, when this file is copied by Bison into a
1478 Bison output file, you may use that output file without restriction.
1479 This special exception was added by the Free Software Foundation
1480 in version 1.24 of Bison. */
1482 b4_token_enums_defines(b4_tokens
)
1484 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1485 m4_ifdef([b4_stype
],
1486 [b4_syncline([b4_stype_line
], [b4_file_name
])
1487 typedef union m4_bregexp(b4_stype
, [^{], [YYSTYPE
])b4_stype YYSTYPE
;
1488 /* Line __line__ of yacc.c. */
1489 b4_syncline([@oline@
], [@ofile@
])],
1490 [typedef int YYSTYPE
;])
1491 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1492 # define YYSTYPE_IS_DECLARED 1
1493 # define YYSTYPE_IS_TRIVIAL 1
1497 [extern YYSTYPE b4_prefix
[]lval
;])
1500 [#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
1501 typedef struct YYLTYPE
1508 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
1509 # define YYLTYPE_IS_DECLARED 1
1510 # define YYLTYPE_IS_TRIVIAL 1
1514 [extern YYLTYPE b4_prefix
[]lloc
;])