1 m4_divert(-1) -*- C
-*-
3 # Yacc compatible skeleton for Bison
4 # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004
5 # Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 ## ---------------- ##
26 ## ---------------- ##
29 m4_define_default([b4_stack_depth_max
], [10000])
30 m4_define_default([b4_stack_depth_init
], [200])
33 ## ------------------------ ##
34 ## Pure/impure interfaces. ##
35 ## ------------------------ ##
38 # b4_pure_if(IF-TRUE, IF-FALSE)
39 # -----------------------------
40 # Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
41 m4_define([b4_Pure_if
],
42 [b4_pure_if([m4_ifset([b4_parse_param
],
49 # Arguments passed to yyerror: user args plus yylloc.
50 m4_define([b4_yyerror_args
],
51 [b4_Pure_if([b4_location_if([&yylloc
, ])])dnl
52 m4_ifset([b4_parse_param
], [b4_c_args(b4_parse_param
), ])])
57 # Accumulate in b4_lex_param all the yylex arguments.
58 # b4_lex_param arrives quoted twice, but we want to keep only one level.
59 m4_define([b4_lex_param
],
60 m4_dquote(b4_pure_if([[[[YYSTYPE
*]], [[&yylval
]]][]dnl
61 b4_location_if([, [[YYLTYPE
*], [&yylloc
]]])m4_ifdef([b4_lex_param
], [, ])])dnl
62 m4_ifdef([b4_lex_param
], b4_lex_param
)))
70 # b4_int_type(MIN, MAX)
71 # ---------------------
72 # Return the smallest int type able to handle numbers ranging from
73 # MIN to MAX (included). We overwrite the version from c.m4 which relies
74 # on "signed char" which is not portable to old K&R compilers.
75 m4_define([b4_int_type
],
76 [m4_if(b4_ints_in($@
, [0], [255]), [1], [unsigned char],
77 b4_ints_in($@
, [-128], [127]), [1], [yysigned_char
],
79 b4_ints_in($@
, [0], [65535]), [1], [unsigned short int],
80 b4_ints_in($@
, [-32768], [32767]), [1], [short int],
82 m4_eval([0 <= $
1]), [1], [unsigned int],
87 ## ----------------- ##
88 ## Semantic Values. ##
89 ## ----------------- ##
92 # b4_lhs_value([TYPE])
93 # --------------------
94 # Expansion of $<TYPE>$.
95 m4_define([b4_lhs_value
],
96 [yyval
[]m4_ifval([$
1], [.$
1])])
99 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
100 # --------------------------------------
101 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
103 m4_define([b4_rhs_value
],
104 [yyvsp@
{m4_eval([$
2 - $
1])@
}m4_ifval([$
3], [.$
3])])
115 m4_define([b4_lhs_location
],
119 # b4_rhs_location(RULE-LENGTH, NUM)
120 # ---------------------------------
121 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
123 m4_define([b4_rhs_location
],
124 [yylsp@
{m4_eval([$
2 - $
1])@
}])
128 ## --------------------------------------------------------- ##
129 ## Defining symbol actions, e.g., printers and destructors. ##
130 ## --------------------------------------------------------- ##
132 # We do want M4 expansion after # for CPP macros.
135 @output @output_parser_name@
136 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
137 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004])[
139 /* As a special exception, when this file is copied by Bison into a
140 Bison output file, you may use that output file without restriction.
141 This special exception was added by the Free Software Foundation
142 in version 1.24 of Bison. */
144 /* Written by Richard Stallman by simplifying the original so called
145 ``semantic'' parser. */
147 /* All symbols defined below should begin with yy or YY, to avoid
148 infringing on user name space. This should be done even for local
149 variables, as they might otherwise be expanded by user macros.
150 There are some unavoidable exceptions within include files to
151 define necessary library symbols; they are noted "INFRINGES ON
152 USER NAME SPACE" below. */
155 m4_if(b4_prefix
[], [yy
], [],
156 [/* Substitute the variable and function names. */
157 #define yyparse b4_prefix[]parse
158 #define yylex b4_prefix[]lex
159 #define yyerror b4_prefix[]error
160 #define yylval b4_prefix[]lval
161 #define yychar b4_prefix[]char
162 #define yydebug b4_prefix[]debug
163 #define yynerrs b4_prefix[]nerrs
164 b4_location_if([#define yylloc b4_prefix[]lloc])])[
166 ]b4_token_defines(b4_tokens
)[
168 /* Copy the first part of user declarations. */
171 /* Enabling traces. */
173 # define YYDEBUG ]b4_debug[
176 /* Enabling verbose error messages. */
177 #ifdef YYERROR_VERBOSE
178 # undef YYERROR_VERBOSE
179 # define YYERROR_VERBOSE 1
181 # define YYERROR_VERBOSE ]b4_error_verbose[
184 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
185 ]m4_ifdef([b4_stype
],
186 [b4_syncline([b4_stype_line
], [b4_filename
])
187 typedef union m4_bregexp(b4_stype
, [^{], [YYSTYPE
])b4_stype YYSTYPE
;
188 /* Line __line__ of yacc.c. */
189 b4_syncline([@oline@
], [@ofile@
])],
190 [typedef int YYSTYPE
;])[
191 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
192 # define YYSTYPE_IS_DECLARED 1
193 # define YYSTYPE_IS_TRIVIAL 1
196 ]b4_location_if([#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
197 typedef struct YYLTYPE
204 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
205 # define YYLTYPE_IS_DECLARED 1
206 # define YYLTYPE_IS_TRIVIAL 1
210 /* Copy the second part of user declarations. */
213 /* Line __line__ of yacc.c. */
214 b4_syncline([@oline@
], [@ofile@
])[
216 #if ! defined (yyoverflow) || YYERROR_VERBOSE
222 # define YYMALLOC malloc
225 /* The parser invokes alloca or malloc; define the necessary symbols. */
227 # ifdef YYSTACK_USE_ALLOCA
228 # if YYSTACK_USE_ALLOCA
229 # define YYSTACK_ALLOC alloca
232 # if defined (alloca) || defined (_ALLOCA_H)
233 # define YYSTACK_ALLOC alloca
236 # define YYSTACK_ALLOC __builtin_alloca
241 # ifdef YYSTACK_ALLOC
242 /* Pacify GCC's `empty if-body' warning. */
243 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
245 # if defined (__STDC__) || defined (__cplusplus)
246 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
247 # define YYSIZE_T size_t
249 # define YYSTACK_ALLOC YYMALLOC
250 # define YYSTACK_FREE YYFREE
252 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
255 #if (! defined (yyoverflow) \
256 && (! defined (__cplusplus) \
257 || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
258 && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
260 /* A type that is properly aligned for any stack member. */
265 ]b4_location_if([ YYLTYPE yyls
;
269 /* The size of the maximum gap between one aligned stack and the next. */
270 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
272 /* The size of an array large to enough to hold all stacks, each with
275 [# define YYSTACK_BYTES(N) \
276 ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
277 + 2 * YYSTACK_GAP_MAXIMUM)],
278 [# define YYSTACK_BYTES(N) \
279 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
280 + YYSTACK_GAP_MAXIMUM)])[
282 /* Copy COUNT objects from FROM to TO. The source and destination do
285 # if defined (__GNUC__) && 1 < __GNUC__
286 # define YYCOPY(To, From, Count) \
287 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
289 # define YYCOPY(To, From, Count) \
292 register YYSIZE_T yyi; \
293 for (yyi = 0; yyi < (Count); yyi++) \
294 (To)[yyi] = (From)[yyi]; \
300 /* Relocate STACK from its old location to the new one. The
301 local variables YYSIZE and YYSTACKSIZE give the old and new number of
302 elements in the stack, and YYPTR gives the new location of the
303 stack. Advance YYPTR to a properly aligned location for the next
305 # define YYSTACK_RELOCATE(Stack) \
308 YYSIZE_T yynewbytes; \
309 YYCOPY (&yyptr->Stack, Stack, yysize); \
310 Stack = &yyptr->Stack; \
311 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
312 yyptr += yynewbytes / sizeof (*yyptr); \
318 #if defined (__STDC__) || defined (__cplusplus)
319 typedef signed char yysigned_char
;
321 typedef short int yysigned_char
;
324 /* YYFINAL -- State number of the termination state. */
325 #define YYFINAL ]b4_final_state_number[
326 /* YYLAST -- Last index in YYTABLE. */
327 #define YYLAST ]b4_last[
329 /* YYNTOKENS -- Number of terminals. */
330 #define YYNTOKENS ]b4_tokens_number[
331 /* YYNNTS -- Number of nonterminals. */
332 #define YYNNTS ]b4_nterms_number[
333 /* YYNRULES -- Number of rules. */
334 #define YYNRULES ]b4_rules_number[
335 /* YYNRULES -- Number of states. */
336 #define YYNSTATES ]b4_states_number[
338 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
339 #define YYUNDEFTOK ]b4_undef_token_number[
340 #define YYMAXUTOK ]b4_user_token_number_max[
342 #define YYTRANSLATE(YYX) \
343 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
345 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
346 static const ]b4_int_type_for([b4_translate
])[ yytranslate
[] =
352 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
354 static const ]b4_int_type_for([b4_prhs
])[ yyprhs
[] =
359 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
360 static const ]b4_int_type_for([b4_rhs
])[ yyrhs
[] =
365 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
366 static const ]b4_int_type_for([b4_rline
])[ yyrline
[] =
372 #if YYDEBUG || YYERROR_VERBOSE
373 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
374 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
375 static const char *const yytname
[] =
382 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
384 static const ]b4_int_type_for([b4_toknum
])[ yytoknum
[] =
390 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
391 static const ]b4_int_type_for([b4_r1
])[ yyr1
[] =
396 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
397 static const ]b4_int_type_for([b4_r2
])[ yyr2
[] =
402 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
403 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
404 means the default is an error. */
405 static const ]b4_int_type_for([b4_defact
])[ yydefact
[] =
410 /* YYDEFGOTO[NTERM-NUM]. */
411 static const ]b4_int_type_for([b4_defgoto
])[ yydefgoto
[] =
416 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
418 #define YYPACT_NINF ]b4_pact_ninf[
419 static const ]b4_int_type_for([b4_pact
])[ yypact
[] =
424 /* YYPGOTO[NTERM-NUM]. */
425 static const ]b4_int_type_for([b4_pgoto
])[ yypgoto
[] =
430 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
431 positive, shift that token. If negative, reduce the rule which
432 number is the opposite. If zero, do what YYDEFACT says.
433 If YYTABLE_NINF, syntax error. */
434 #define YYTABLE_NINF ]b4_table_ninf[
435 static const ]b4_int_type_for([b4_table
])[ yytable
[] =
440 static const ]b4_int_type_for([b4_check
])[ yycheck
[] =
445 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
446 symbol of state STATE-NUM. */
447 static const ]b4_int_type_for([b4_stos
])[ yystos
[] =
452 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
453 # define YYSIZE_T __SIZE_TYPE__
455 #if ! defined (YYSIZE_T) && defined (size_t)
456 # define YYSIZE_T size_t
458 #if ! defined (YYSIZE_T)
459 # if defined (__STDC__) || defined (__cplusplus)
460 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
461 # define YYSIZE_T size_t
464 #if ! defined (YYSIZE_T)
465 # define YYSIZE_T unsigned int
468 #define yyerrok (yyerrstatus = 0)
469 #define yyclearin (yychar = YYEMPTY)
473 #define YYACCEPT goto yyacceptlab
474 #define YYABORT goto yyabortlab
475 #define YYERROR goto yyerrorlab
478 /* Like YYERROR except do call yyerror. This remains here temporarily
479 to ease the transition to the new meaning of YYERROR, for GCC.
480 Once GCC version 2 has supplanted version 1, this can go. */
482 #define YYFAIL goto yyerrlab
484 #define YYRECOVERING() (!!yyerrstatus)
486 #define YYBACKUP(Token, Value) \
488 if (yychar == YYEMPTY && yylen == 1) \
492 yytoken = YYTRANSLATE (yychar); \
498 yyerror (]b4_yyerror_args["syntax error: cannot back up");\
505 #define YYERRCODE 256
508 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
509 If N is 0, then set CURRENT to the empty location which ends
510 the previous symbol: RHS[0] (always defined). */
512 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
513 #ifndef YYLLOC_DEFAULT
514 # define YYLLOC_DEFAULT(Current, Rhs, N) \
518 (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
519 (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
520 (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
521 (Current).last_column = YYRHSLOC(Rhs, N).last_column; \
525 (Current).first_line = (Current).last_line = \
526 YYRHSLOC(Rhs, 0).last_line; \
527 (Current).first_column = (Current).last_column = \
528 YYRHSLOC(Rhs, 0).last_column; \
534 /* YY_LOCATION_PRINT -- Print the location on the stream.
535 This macro was not mandated originally: define only if we know
536 we won't break user code: when these are the locations we know. */
538 #ifndef YY_LOCATION_PRINT
539 # if YYLTYPE_IS_TRIVIAL
540 # define YY_LOCATION_PRINT(File, Loc) \
541 fprintf (File, "%d.%d-%d.%d", \
542 (Loc).first_line, (Loc).first_column, \
543 (Loc).last_line, (Loc).last_column)
545 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
550 /* YYLEX -- calling `yylex' with the right arguments. */
553 # define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM)
555 # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
558 /* Enable debugging if requested. */
562 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
563 # define YYFPRINTF fprintf
566 # define YYDPRINTF(Args) \
572 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
576 YYFPRINTF (stderr, "%s ", Title); \
577 yysymprint (stderr, \
578 Type, Value]b4_location_if([, Location])[); \
579 YYFPRINTF (stderr, "\n"); \
583 /*------------------------------------------------------------------.
584 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
586 `------------------------------------------------------------------*/
588 ]b4_c_function_def([yy_stack_print
], [static void],
589 [[short int *bottom
], [bottom
]],
590 [[short int *top
], [top
]])[
592 YYFPRINTF (stderr
, "Stack now");
593 for (/* Nothing. */; bottom
<= top
; ++bottom
)
594 YYFPRINTF (stderr
, " %d", *bottom
);
595 YYFPRINTF (stderr
, "\n");
598 # define YY_STACK_PRINT(Bottom, Top) \
601 yy_stack_print ((Bottom), (Top)); \
605 /*------------------------------------------------.
606 | Report that the YYRULE is going to be reduced. |
607 `------------------------------------------------*/
609 ]b4_c_function_def([yy_reduce_print
], [static void],
610 [[int yyrule
], [yyrule
]])[
613 unsigned int yylno
= yyrline
[yyrule
];
614 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
616 /* Print the symbols being reduced, and their result. */
617 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
618 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
619 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
622 # define YY_REDUCE_PRINT(Rule) \
625 yy_reduce_print (Rule); \
628 /* Nonzero means print parse trace. It is left uninitialized so that
629 multiple parsers can coexist. */
632 # define YYDPRINTF(Args)
633 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
634 # define YY_STACK_PRINT(Bottom, Top)
635 # define YY_REDUCE_PRINT(Rule)
636 #endif /* !YYDEBUG */
639 /* YYINITDEPTH -- initial size of the parser's stacks. */
641 # define YYINITDEPTH ]b4_stack_depth_init[
644 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
645 if the built-in stack extension method is used).
647 Do not make this value too large; the results are undefined if
648 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
649 evaluated with infinite-precision integer arithmetic. */
651 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
656 # define YYMAXDEPTH ]b4_stack_depth_max[
664 # if defined (__GLIBC__) && defined (_STRING_H)
665 # define yystrlen strlen
667 /* Return the length of YYSTR. */
669 # if defined (__STDC__) || defined (__cplusplus)
670 yystrlen (const char *yystr
)
676 register const char *yys
= yystr
;
678 while (*yys
++ != '\0')
681 return yys
- yystr
- 1;
687 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
688 # define yystpcpy stpcpy
690 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
693 # if defined (__STDC__) || defined (__cplusplus)
694 yystpcpy (char *yydest
, const char *yysrc
)
696 yystpcpy (yydest
, yysrc
)
701 register char *yyd
= yydest
;
702 register const char *yys
= yysrc
;
704 while ((*yyd
++ = *yys
++) != '\0')
712 #endif /* !YYERROR_VERBOSE */
717 ]b4_yysymprint_generate([b4_c_function_def
])[
718 #endif /* ! YYDEBUG */
719 ]b4_yydestruct_generate([b4_c_function_def
])
722 /* Prevent warnings from -Wmissing-prototypes. */
725 # if defined (__STDC__) || defined (__cplusplus)
726 int yyparse (void *YYPARSE_PARAM
);
730 #else /* ! YYPARSE_PARAM */
731 b4_c_function_decl([yyparse
], [int], b4_parse_param
)
732 #endif /* ! YYPARSE_PARAM */
735 m4_divert_push([KILL
])# ======================== M4 code.
736 # b4_declare_parser_variables
737 # ---------------------------
738 # Declare the variables that are global, or local to YYPARSE if
740 m4_define([b4_declare_parser_variables
],
741 [/* The look-ahead symbol. */
744 /* The semantic value of the look-ahead symbol. */
747 /* Number of syntax errors so far. */
748 int yynerrs
;b4_location_if([
749 /* Location data for the look-ahead symbol. */
752 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
755 [b4_declare_parser_variables
])
763 # if defined (__STDC__) || defined (__cplusplus)
764 int yyparse (void *YYPARSE_PARAM
)
766 int yyparse (YYPARSE_PARAM
)
769 #else /* ! YYPARSE_PARAM */
770 b4_c_function_def([yyparse
], [int], b4_parse_param
)
773 ]b4_pure_if([b4_declare_parser_variables
])[
774 register int yystate
;
777 /* Number of tokens to shift before error messages enabled. */
779 /* Look-ahead token as an internal (translated) token number. */
782 /* Three stacks and their tools:
783 `yyss': related to states,
784 `yyvs': related to semantic values,
785 `yyls': related to locations.
787 Refer to the stacks thru separate pointers, to allow yyoverflow
788 to reallocate them elsewhere. */
790 /* The state stack. */
791 short int yyssa
[YYINITDEPTH
];
792 short int *yyss
= yyssa
;
793 register short int *yyssp
;
795 /* The semantic value stack. */
796 YYSTYPE yyvsa
[YYINITDEPTH
];
797 YYSTYPE
*yyvs
= yyvsa
;
798 register YYSTYPE
*yyvsp
;
801 [[ /* The location stack. */
802 YYLTYPE yylsa
[YYINITDEPTH
];
803 YYLTYPE
*yyls
= yylsa
;
805 /* The locations where the error started and ended. */
806 YYLTYPE yyerror_range
[2];]])[
808 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
810 YYSIZE_T yystacksize
= YYINITDEPTH
;
812 /* The variables used to return semantic value and location from the
815 ]b4_location_if([ YYLTYPE yyloc
;])[
817 /* When reducing, the number of symbols on the RHS of the reduced
821 YYDPRINTF ((stderr
, "Starting parse\n"));
826 yychar
= YYEMPTY
; /* Cause a token to be read. */
828 /* Initialize stack pointers.
829 Waste one element of value and location stack
830 so that they stay on the same level as the state stack.
831 The wasted elements are never initialized. */
835 ]b4_location_if([[ yylsp
= yyls
;
836 #if YYLTYPE_IS_TRIVIAL
837 /* Initialize the default location before parsing starts. */
838 yylloc
.first_line
= yylloc
.last_line
= 1;
839 yylloc
.first_column
= yylloc
.last_column
= 0;
842 m4_ifdef([b4_initial_action
], [
843 m4_pushdef([b4_at_dollar
], [yylloc
])dnl
844 m4_pushdef([b4_dollar_dollar
], [yylval
])dnl
845 /* User initialization code. */
847 m4_popdef([b4_dollar_dollar
])dnl
848 m4_popdef([b4_at_dollar
])dnl
849 /* Line __line__ of yacc.c. */
850 b4_syncline([@oline@
], [@ofile@
])])dnl
853 ]b4_location_if([[ yylsp
[0] = yylloc
;
857 /*------------------------------------------------------------.
858 | yynewstate -- Push a new state, which is found in yystate. |
859 `------------------------------------------------------------*/
861 /* In all cases, when you get here, the value and location stacks
862 have just been pushed. so pushing a state here evens the stacks.
869 if (yyss
+ yystacksize
- 1 <= yyssp
)
871 /* Get the current used size of the three stacks, in elements. */
872 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
876 /* Give user a chance to reallocate the stack. Use copies of
877 these so that the &'s don't force the real ones into
879 YYSTYPE
*yyvs1
= yyvs
;
880 short int *yyss1
= yyss
;
881 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
883 /* Each stack pointer address is followed by the size of the
884 data in use in that stack, in bytes. This used to be a
885 conditional around just the two extra args, but that might
886 be undefined if yyoverflow is a macro. */
887 yyoverflow ("parser stack overflow",
888 &yyss1
, yysize
* sizeof (*yyssp
),
889 &yyvs1
, yysize
* sizeof (*yyvsp
),
890 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
892 ]b4_location_if([ yyls
= yyls1
;])[
896 #else /* no yyoverflow */
897 # ifndef YYSTACK_RELOCATE
900 /* Extend the stack our own way. */
901 if (YYMAXDEPTH
<= yystacksize
)
904 if (YYMAXDEPTH
< yystacksize
)
905 yystacksize
= YYMAXDEPTH
;
908 short int *yyss1
= yyss
;
909 union yyalloc
*yyptr
=
910 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
913 YYSTACK_RELOCATE (yyss
);
914 YYSTACK_RELOCATE (yyvs
);
915 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
916 # undef YYSTACK_RELOCATE
918 YYSTACK_FREE (yyss1
);
921 #endif /* no yyoverflow */
923 yyssp
= yyss
+ yysize
- 1;
924 yyvsp
= yyvs
+ yysize
- 1;
925 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
927 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
928 (unsigned long int) yystacksize
));
930 if (yyss
+ yystacksize
- 1 <= yyssp
)
934 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
943 /* Do appropriate processing given the current state. */
944 /* Read a look-ahead token if we need one and don't already have one. */
947 /* First try to decide what to do without reference to look-ahead token. */
949 yyn
= yypact
[yystate
];
950 if (yyn
== YYPACT_NINF
)
953 /* Not known => get a look-ahead token if don't already have one. */
955 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
956 if (yychar
== YYEMPTY
)
958 YYDPRINTF ((stderr
, "Reading a token: "));
964 yychar
= yytoken
= YYEOF
;
965 YYDPRINTF ((stderr
, "Now at end of input.\n"));
969 yytoken
= YYTRANSLATE (yychar
);
970 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
973 /* If the proper action on seeing token YYTOKEN is to reduce or to
974 detect an error, take that action. */
976 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
981 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
990 /* Shift the look-ahead token. */
991 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
993 /* Discard the token being shifted unless it is eof. */
998 ]b4_location_if([ *++yylsp
= yylloc
;])[
1000 /* Count tokens shifted since error; after three, turn off error
1009 /*-----------------------------------------------------------.
1010 | yydefault -- do the default action for the current state. |
1011 `-----------------------------------------------------------*/
1013 yyn
= yydefact
[yystate
];
1019 /*-----------------------------.
1020 | yyreduce -- Do a reduction. |
1021 `-----------------------------*/
1023 /* yyn is the number of a rule to reduce with. */
1026 /* If YYLEN is nonzero, implement the default value of the action:
1029 Otherwise, the following line sets YYVAL to garbage.
1030 This behavior is undocumented and Bison
1031 users should not rely upon it. Assigning to YYVAL
1032 unconditionally makes the parser a bit smaller, and it avoids a
1033 GCC warning that YYVAL may be used uninitialized. */
1034 yyval
= yyvsp
[1-yylen
];
1037 [[ /* Default location. */
1038 YYLLOC_DEFAULT (yyloc
, yylsp
- yylen
, yylen
);]])[
1039 YY_REDUCE_PRINT (yyn
);
1045 /* Line __line__ of yacc.c. */
1046 b4_syncline([@oline@
], [@ofile@
])
1050 ]b4_location_if([ yylsp
-= yylen
;])[
1052 YY_STACK_PRINT (yyss
, yyssp
);
1055 ]b4_location_if([ *++yylsp
= yyloc
;])[
1057 /* Now `shift' the result of the reduction. Determine what state
1058 that goes to, based on the state we popped back to and the rule
1059 number reduced by. */
1063 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1064 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1065 yystate
= yytable
[yystate
];
1067 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1072 /*------------------------------------.
1073 | yyerrlab -- here on detecting error |
1074 `------------------------------------*/
1076 /* If not already recovering from an error, report this error. */
1081 yyn
= yypact
[yystate
];
1083 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1085 YYSIZE_T yysize
= 0;
1086 int yytype
= YYTRANSLATE (yychar
);
1087 const char* yyprefix
;
1091 /* Start YYX at -YYN if negative to avoid negative indexes in
1093 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1095 /* Stay within bounds of both yycheck and yytname. */
1096 int yychecklim
= YYLAST
- yyn
;
1097 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1100 yyprefix
= ", expecting ";
1101 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1102 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1104 yysize
+= yystrlen (yyprefix
) + yystrlen (yytname
[yyx
]);
1112 yysize
+= (sizeof ("syntax error, unexpected ")
1113 + yystrlen (yytname
[yytype
]));
1114 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1117 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
1118 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1122 yyprefix
= ", expecting ";
1123 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1124 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1126 yyp
= yystpcpy (yyp
, yyprefix
);
1127 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1131 yyerror (]b4_yyerror_args
[yymsg
);
1132 YYSTACK_FREE (yymsg
);
1135 yyerror (]b4_yyerror_args
["syntax error; also virtual memory exhausted");
1138 #endif /* YYERROR_VERBOSE */
1139 yyerror (]b4_yyerror_args
["syntax error");
1142 ]b4_location_if([[ yyerror_range
[0] = yylloc
;]])[
1144 if (yyerrstatus
== 3)
1146 /* If just tried and failed to reuse look-ahead token after an
1147 error, discard it. */
1149 if (yychar
<= YYEOF
)
1151 /* If at end of input, pop the error token,
1152 then the rest of the stack, then return failure. */
1153 if (yychar
== YYEOF
)
1156 ]b4_location_if([[ yyerror_range
[0] = *yylsp
;]])[
1160 yydestruct ("Error: popping",
1161 yystos
[*yyssp
], yyvsp
]b4_location_if([, yylsp
])[);
1166 yydestruct ("Error: discarding", yytoken
, &yylval
]b4_location_if([, &yylloc
])[);
1171 /* Else will try to reuse look-ahead token after shifting the error
1176 /*---------------------------------------------------.
1177 | yyerrorlab -- error raised explicitly by YYERROR. |
1178 `---------------------------------------------------*/
1182 /* Pacify GCC when the user code never invokes YYERROR and the label
1183 yyerrorlab therefore never appears in user code. */
1188 ]b4_location_if([[ yyerror_range
[0] = yylsp
[1-yylen
];
1196 /*-------------------------------------------------------------.
1197 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1198 `-------------------------------------------------------------*/
1200 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1204 yyn
= yypact
[yystate
];
1205 if (yyn
!= YYPACT_NINF
)
1208 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1216 /* Pop the current state because it cannot handle the error token. */
1220 ]b4_location_if([[ yyerror_range
[0] = *yylsp
;]])[
1221 yydestruct ("Error: popping", yystos
[yystate
], yyvsp
]b4_location_if([, yylsp
])[);
1224 YY_STACK_PRINT (yyss
, yyssp
);
1232 yyerror_range
[1] = yylloc
;
1233 /* Using YYLLOC is tempting, but would change the location of
1234 the look-ahead. YYLOC is available though. */
1235 YYLLOC_DEFAULT (yyloc
, yyerror_range
- 1, 2);
1236 *++yylsp
= yyloc
;]])[
1238 /* Shift the error token. */
1239 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
1245 /*-------------------------------------.
1246 | yyacceptlab -- YYACCEPT comes here. |
1247 `-------------------------------------*/
1252 /*-----------------------------------.
1253 | yyabortlab -- YYABORT comes here. |
1254 `-----------------------------------*/
1256 yydestruct ("Error: discarding lookahead",
1257 yytoken
, &yylval
]b4_location_if([, &yylloc
])[);
1263 /*----------------------------------------------.
1264 | yyoverflowlab -- parser overflow comes here. |
1265 `----------------------------------------------*/
1267 yyerror (]b4_yyerror_args
["parser stack overflow");
1275 YYSTACK_FREE (yyss
);
1282 m4_if(b4_defines_flag
, 0, [],
1283 [@output @output_header_name@
1284 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1285 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004])
1287 /* As a special exception, when this file is copied by Bison into a
1288 Bison output file, you may use that output file without restriction.
1289 This special exception was added by the Free Software Foundation
1290 in version 1.24 of Bison. */
1292 b4_token_defines(b4_tokens
)
1294 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1295 m4_ifdef([b4_stype
],
1296 [b4_syncline([b4_stype_line
], [b4_filename
])
1297 typedef union m4_bregexp(b4_stype
, [^{], [YYSTYPE
])b4_stype YYSTYPE
;
1298 /* Line __line__ of yacc.c. */
1299 b4_syncline([@oline@
], [@ofile@
])],
1300 [typedef int YYSTYPE
;])
1301 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1302 # define YYSTYPE_IS_DECLARED 1
1303 # define YYSTYPE_IS_TRIVIAL 1
1307 [extern YYSTYPE b4_prefix
[]lval
;])
1310 [#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
1311 typedef struct YYLTYPE
1318 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
1319 # define YYLTYPE_IS_DECLARED 1
1320 # define YYLTYPE_IS_TRIVIAL 1
1324 [extern YYLTYPE b4_prefix
[]lloc
;])