1 m4_divert(-1) -*- C
-*-
4 # Yacc compatible skeleton for Bison
5 # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002
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., 59 Temple Place, Suite 330, Boston, MA
25 ## ---------------- ##
27 ## ---------------- ##
30 m4_define_default([b4_stack_depth_max
], [10000])
31 m4_define_default([b4_stack_depth_init
], [200])
34 m4_define_default([b4_location_type
], [yyltype
])
36 # Accumule in b4_lex_param all the yylex arguments.
37 # Yes, this is quite ugly...
38 m4_define([b4_lex_param
],
39 m4_dquote(b4_pure_if([[[[YYSTYPE
*]], [[&yylval
]]][]dnl
40 b4_location_if([, [[YYLTYPE
*], [&yylloc
]]])])dnl
41 m4_ifdef([b4_lex_param
], [, ]b4_lex_param
)))
43 # Yes, this is quite ugly...
44 m4_define_default([b4_parse_param
])
45 m4_ifdef([b4_parse_param
],
46 [m4_define([b4_parse_param
],
55 # b4_int_type(MIN, MAX)
56 # ---------------------
57 # Return the smallest int type able to handle numbers ranging from
58 # MIN to MAX (included). We overwrite the version from c.m4 which relies
59 # on `signed char' which is not portable to old K&R compilers.
60 m4_define([b4_int_type],
61 [m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
62 b4_ints_in($@, [-128], [127]), [1], [yysigned_char],
64 b4_ints_in($@, [0], [65535]), [1], [unsigned short],
65 b4_ints_in($@, [-32768], [32767]), [1], [short],
67 m4_eval([0 <= $1]), [1], [unsigned int],
72 ## ----------------- ##
73 ## Semantic Values. ##
74 ## ----------------- ##
77 # b4_lhs_value([TYPE])
78 # --------------------
79 # Expansion of $<TYPE>$.
80 m4_define([b4_lhs_value],
81 [yyval[]m4_ifval([$1], [.$1])])
84 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
85 # --------------------------------------
86 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
88 m4_define([b4_rhs_value],
89 [yyvsp@<:@m4_eval([$2 - $1])@:>@m4_ifval([$3], [.$3])])
100 m4_define([b4_lhs_location],
104 # b4_rhs_location(RULE-LENGTH, NUM)
105 # ---------------------------------
106 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
108 m4_define([b4_rhs_location],
109 [yylsp@<:@m4_eval([$2 - $1])@:>@])
113 ## ------------------- ##
114 ## Output file names. ##
115 ## ------------------- ##
117 m4_define_default([b4_input_suffix], [.y])
119 m4_define_default([b4_output_parser_suffix],
120 [m4_translit(b4_input_suffix, [yY], [cC])])
122 m4_define_default([b4_output_parser_name],
123 [b4_output_prefix[]b4_output_infix[]b4_output_parser_suffix[]])
126 m4_define_default([b4_output_header_suffix],
127 [m4_translit(b4_input_suffix, [yY], [hH])])
129 m4_define_default([b4_output_header_name],
130 [b4_output_prefix[]b4_output_infix[]b4_output_header_suffix[]])
132 m4_define_default([b4_header_guard],
133 [m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name),
134 [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])])
138 ## --------------------------------------------------------- ##
139 ## Defining symbol actions, e.g., printers and destructors. ##
140 ## --------------------------------------------------------- ##
142 # b4_symbol_actions(FILENAME, LINENO,
143 # SYMBOL-TAG, SYMBOL-NUM,
144 # SYMBOL-ACTION, SYMBOL-TYPENAME)
145 # -------------------------------------------------
146 m4_define([b4_symbol_actions],
147 [m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl
148 m4_pushdef([b4_at_dollar], [yylocation])dnl
152 #line __oline__ "__ofile__"
154 m4_popdef([b4_at_dollar])dnl
155 m4_popdef([b4_dollar_dollar])dnl
159 # We do want M4 expansion after # for CPP macros.
162 #output "b4_output_parser_name"
163 b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
164 [1984, 1989, 1990, 2000, 2001, 2002])
166 /* As a special exception, when this file is copied by Bison into a
167 Bison output file, you may use that output file without restriction.
168 This special exception was added by the Free Software Foundation
169 in version 1.24 of Bison. */
171 /* Written by Richard Stallman by simplifying the original so called
172 ``semantic'' parser. */
174 /* All symbols defined below should begin with yy or YY, to avoid
175 infringing on user name space. This should be done even for local
176 variables, as they might otherwise be expanded by user macros.
177 There are some unavoidable exceptions within include files to
178 define necessary library symbols; they are noted "INFRINGES ON
179 USER NAME SPACE" below. */
181 /* Identify Bison output. */
185 #define YYPURE b4_pure
187 /* Using locations. */
188 #define YYLSP_NEEDED b4_locations_flag
190 m4_if(b4_prefix[], [yy], [],
191 [/* If NAME_PREFIX is specified substitute the variables and functions
193 #define yyparse b4_prefix[]parse
194 #define yylex b4_prefix[]lex
195 #define yyerror b4_prefix[]error
196 #define yylval b4_prefix[]lval
197 #define yychar b4_prefix[]char
198 #define yydebug b4_prefix[]debug
199 #define yynerrs b4_prefix[]nerrs
200 b4_location_if([#define yylloc b4_prefix[]lloc])])
202 b4_token_defines(b4_tokens)
204 /* Copy the first part of user declarations. */
207 /* Enabling traces. */
209 # define YYDEBUG b4_debug
212 /* Enabling verbose error messages. */
213 #ifdef YYERROR_VERBOSE
214 # undef YYERROR_VERBOSE
215 # define YYERROR_VERBOSE 1
217 # define YYERROR_VERBOSE b4_error_verbose
222 [#line b4_stype_line "b4_filename"
223 typedef union b4_stype yystype;
224 /* Line __line__ of __file__. */
225 #line __oline__ "__ofile__"],
226 [typedef int yystype;])
227 # define YYSTYPE yystype
228 # define YYSTYPE_IS_TRIVIAL 1
232 typedef struct yyltype
239 # define YYLTYPE b4_location_type
240 # define YYLTYPE_IS_TRIVIAL 1
243 /* Copy the second part of user declarations. */
246 /* Line __line__ of __file__. */
247 #line __oline__ "__ofile__"
249 #if ! defined (yyoverflow) || YYERROR_VERBOSE
251 /* The parser invokes alloca or malloc; define the necessary symbols. */
253 # if YYSTACK_USE_ALLOCA
254 # define YYSTACK_ALLOC alloca
256 # ifndef YYSTACK_USE_ALLOCA
257 # if defined (alloca) || defined (_ALLOCA_H)
258 # define YYSTACK_ALLOC alloca
261 # define YYSTACK_ALLOC __builtin_alloca
267 # ifdef YYSTACK_ALLOC
268 /* Pacify GCC's `empty if-body' warning. */
269 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
271 # if defined (__STDC__) || defined (__cplusplus)
272 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
273 # define YYSIZE_T size_t
275 # define YYSTACK_ALLOC malloc
276 # define YYSTACK_FREE free
278 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
281 #if (! defined (yyoverflow) \
282 && (! defined (__cplusplus) \
283 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
285 /* A type that is properly aligned for any stack member. */
290 b4_location_if([ YYLTYPE yyls;
294 /* The size of the maximum gap between one aligned stack and the next. */
295 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
297 /* The size of an array large to enough to hold all stacks, each with
300 [# define YYSTACK_BYTES(N) \
301 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
302 + 2 * YYSTACK_GAP_MAX)],
303 [# define YYSTACK_BYTES(N) \
304 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
307 /* Copy COUNT objects from FROM to TO. The source and destination do
311 # define YYCOPY(To, From, Count) \
312 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
314 # define YYCOPY(To, From, Count) \
317 register YYSIZE_T yyi; \
318 for (yyi = 0; yyi < (Count); yyi++) \
319 (To)[[yyi]] = (From)[[yyi]]; \
325 /* Relocate STACK from its old location to the new one. The
326 local variables YYSIZE and YYSTACKSIZE give the old and new number of
327 elements in the stack, and YYPTR gives the new location of the
328 stack. Advance YYPTR to a properly aligned location for the next
330 # define YYSTACK_RELOCATE(Stack) \
333 YYSIZE_T yynewbytes; \
334 YYCOPY (&yyptr->Stack, Stack, yysize); \
335 Stack = &yyptr->Stack; \
336 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
337 yyptr += yynewbytes / sizeof (*yyptr); \
343 #if defined (__STDC__) || defined (__cplusplus)
344 typedef signed char yysigned_char;
346 typedef short yysigned_char;
349 /* YYFINAL -- State number of the termination state. */
350 #define YYFINAL b4_final_state_number
351 /* YYLAST -- Last index in YYTABLE. */
352 #define YYLAST b4_last
354 /* YYNTOKENS -- Number of terminals. */
355 #define YYNTOKENS b4_tokens_number
356 /* YYNNTS -- Number of nonterminals. */
357 #define YYNNTS b4_nterms_number
358 /* YYNRULES -- Number of rules. */
359 #define YYNRULES b4_rules_number
360 /* YYNRULES -- Number of states. */
361 #define YYNSTATES b4_states_number
363 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
364 #define YYUNDEFTOK b4_undef_token_number
365 #define YYMAXUTOK b4_user_token_number_max
367 #define YYTRANSLATE(X) \
368 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
370 /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
371 static const b4_int_type_for([b4_translate]) yytranslate[[]] =
377 /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in
379 static const b4_int_type_for([b4_prhs]) yyprhs[[]] =
384 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
385 static const b4_int_type_for([b4_rhs]) yyrhs[[]] =
390 /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */
391 static const b4_int_type_for([b4_rline]) yyrline[[]] =
397 #if YYDEBUG || YYERROR_VERBOSE
398 /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
399 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
400 static const char *const yytname[[]] =
407 /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
409 static const b4_int_type_for([b4_toknum]) yytoknum[[]] =
415 /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
416 static const b4_int_type_for([b4_r1]) yyr1[[]] =
421 /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */
422 static const b4_int_type_for([b4_r2]) yyr2[[]] =
427 /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
428 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
429 means the
default is an error
. */
430 static const b4_int_type_for([b4_defact
]) yydefact
[[]] =
435 /* YYDEFGOTO[[NTERM-NUM]]. */
436 static const b4_int_type_for([b4_defgoto
]) yydefgoto
[[]] =
441 /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
443 #define YYPACT_NINF b4_pact_ninf
444 static const b4_int_type_for([b4_pact
]) yypact
[[]] =
449 /* YYPGOTO[[NTERM-NUM]]. */
450 static const b4_int_type_for([b4_pgoto
]) yypgoto
[[]] =
455 /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If
456 positive, shift that token. If negative, reduce the rule which
457 number is the opposite. If zero, do what YYDEFACT says.
458 If YYTABLE_NINF, parse error. */
459 #define YYTABLE_NINF b4_table_ninf
460 static const b4_int_type_for([b4_table
]) yytable
[[]] =
465 static const b4_int_type_for([b4_check
]) yycheck
[[]] =
470 /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
471 symbol of state STATE-NUM. */
472 static const b4_int_type_for([b4_stos
]) yystos
[[]] =
477 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
478 # define YYSIZE_T __SIZE_TYPE__
480 #if ! defined (YYSIZE_T) && defined (size_t)
481 # define YYSIZE_T size_t
483 #if ! defined (YYSIZE_T)
484 # if defined (__STDC__) || defined (__cplusplus)
485 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
486 # define YYSIZE_T size_t
489 #if ! defined (YYSIZE_T)
490 # define YYSIZE_T unsigned int
493 #define yyerrok (yyerrstatus = 0)
494 #define yyclearin (yychar = YYEMPTY)
498 #define YYACCEPT goto yyacceptlab
499 #define YYABORT goto yyabortlab
500 #define YYERROR goto yyerrlab1
502 /* Like YYERROR except do call yyerror. This remains here temporarily
503 to ease the transition to the new meaning of YYERROR, for GCC.
504 Once GCC version 2 has supplanted version 1, this can go. */
506 #define YYFAIL goto yyerrlab
508 #define YYRECOVERING() (!!yyerrstatus)
510 #define YYBACKUP(Token, Value) \
512 if (yychar == YYEMPTY && yylen == 1) \
516 yychar1 = YYTRANSLATE (yychar); \
522 yyerror ("syntax error: cannot back up"); \
528 #define YYERRCODE 256
530 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
533 #ifndef YYLLOC_DEFAULT
534 # define YYLLOC_DEFAULT(Current, Rhs, N) \
535 Current.first_line = Rhs[[1]].first_line; \
536 Current.first_column = Rhs[[1]].first_column; \
537 Current.last_line = Rhs[[N]].last_line; \
538 Current.last_column = Rhs[[N]].last_column;
541 /* YYLEX -- calling `yylex' with the right arguments. */
544 # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)
546 # define YYLEX b4_c_function_call([yylex], [int], b4_lex_param)
549 /* Enable debugging if requested. */
553 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
554 # define YYFPRINTF fprintf
557 # define YYDPRINTF(Args) \
562 # define YYDSYMPRINT(Args) \
567 /* Nonzero means print parse trace. It is left uninitialized so that
568 multiple parsers can coexist. */
571 # define YYDPRINTF(Args)
572 # define YYDSYMPRINT(Args)
573 #endif /* !YYDEBUG */
575 /* YYINITDEPTH -- initial size of the parser's stacks. */
577 # define YYINITDEPTH b4_stack_depth_init
580 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
581 if the built-in stack extension method is used).
583 Do not make this value too large; the results are undefined if
584 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
585 evaluated with infinite-precision integer arithmetic. */
592 # define YYMAXDEPTH b4_stack_depth_max
600 # if defined (__GLIBC__) && defined (_STRING_H)
601 # define yystrlen strlen
603 /* Return the length of YYSTR. */
605 # if defined (__STDC__) || defined (__cplusplus)
606 yystrlen (const char *yystr
)
612 register const char *yys
= yystr
;
614 while (*yys
++ != '\0')
617 return yys
- yystr
- 1;
623 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
624 # define yystpcpy stpcpy
626 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
629 # if defined (__STDC__) || defined (__cplusplus)
630 yystpcpy (char *yydest
, const char *yysrc
)
632 yystpcpy (yydest
, yysrc
)
637 register char *yyd
= yydest
;
638 register const char *yys
= yysrc
;
640 while ((*yyd
++ = *yys
++) != '\0')
648 #endif /* !YYERROR_VERBOSE */
653 /*-----------------------------.
654 | Print this symbol on YYOUT. |
655 `-----------------------------*/
657 b4_c_function_def([yysymprint
],
659 [[FILE *yyout
], [yyout
]],
660 [[int yytype
], [yytype
]],
661 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
662 [[YYLTYPE yylocation
], [yylocation
]]]))
664 /* Pacify ``unused variable'' warnings. */
666 b4_location_if([ (void) yylocation
;
669 if (yytype
< YYNTOKENS
)
671 YYFPRINTF (yyout
, "token %s (", yytname
[[yytype]]);
673 YYPRINT (yyout
, yytoknum
[[yytype]], yyvalue
);
677 YYFPRINTF (yyout
, "nterm %s (", yytname
[[yytype]]);
681 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_printers
]))dnl
685 YYFPRINTF (yyout
, ")");
687 #endif /* YYDEBUG. */
690 /*-----------------------------------------------.
691 | Release the memory associated to this symbol. |
692 `-----------------------------------------------*/
694 b4_c_function_def([yydestruct
],
696 [[int yytype
], [yytype
]],
697 [[YYSTYPE yyvalue
], [yyvalue
]]b4_location_if([,
698 [[YYLTYPE yylocation
], [yylocation
]]]))
700 /* Pacify ``unused variable'' warnings. */
702 b4_location_if([ (void) yylocation
;
707 m4_map([b4_symbol_actions
], m4_defn([b4_symbol_destructors
]))dnl
715 /* Prevent warnings from -Wmissing-prototypes. */
718 # if defined (__STDC__) || defined (__cplusplus)
719 int yyparse (void *YYPARSE_PARAM
);
723 #else /* ! YYPARSE_PARAM */
724 b4_c_function_decl([yyparse
], [int], b4_parse_param
)
728 m4_divert_push([KILL
])# ======================== M4 code.
729 # b4_declare_parser_variables
730 # ---------------------------
731 # Declare the variables that are global, or local to YYPARSE if
733 m4_define([b4_declare_parser_variables
],
734 [/* The lookahead symbol. */
737 /* The semantic value of the lookahead symbol. */
740 /* Number of parse errors so far. */
741 int yynerrs
;b4_location_if([
742 /* Location data for the lookahead symbol. */
745 m4_divert_pop([KILL
])dnl
# ====================== End of M4 code.
748 [b4_declare_parser_variables
])
756 # if defined (__STDC__) || defined (__cplusplus)
757 int yyparse (void *YYPARSE_PARAM
)
759 int yyparse (YYPARSE_PARAM
)
762 #else /* ! YYPARSE_PARAM */
763 b4_c_function_def([yyparse
], [int], b4_parse_param
)
766 ]b4_pure_if([b4_declare_parser_variables
])[
767 register int yystate
;
770 /* Number of tokens to shift before error messages enabled. */
772 /* Lookahead token as an internal (translated) token number. */
775 /* Three stacks and their tools:
776 `yyss': related to states,
777 `yyvs': related to semantic values,
778 `yyls': related to locations.
780 Refer to the stacks thru separate pointers, to allow yyoverflow
781 to reallocate them elsewhere. */
783 /* The state stack. */
784 short yyssa
[YYINITDEPTH
];
786 register short *yyssp
;
788 /* The semantic value stack. */
789 YYSTYPE yyvsa
[YYINITDEPTH
];
790 YYSTYPE
*yyvs
= yyvsa
;
791 register YYSTYPE
*yyvsp
;
794 [[ /* The location stack. */
795 YYLTYPE yylsa
[YYINITDEPTH
];
796 YYLTYPE
*yyls
= yylsa
;
799 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
801 YYSIZE_T yystacksize
= YYINITDEPTH
;
803 /* The variables used to return semantic value and location from the
806 ]b4_location_if([ YYLTYPE yyloc
;])[
808 /* When reducing, the number of symbols on the RHS of the reduced
812 YYDPRINTF ((stderr
, "Starting parse\n"));
817 yychar
= YYEMPTY
; /* Cause a token to be read. */
819 /* Initialize stack pointers.
820 Waste one element of value and location stack
821 so that they stay on the same level as the state stack.
822 The wasted elements are never initialized. */
826 ]b4_location_if([ yylsp
= yyls
;])[
829 /*------------------------------------------------------------.
830 | yynewstate -- Push a new state, which is found in yystate. |
831 `------------------------------------------------------------*/
833 /* In all cases, when you get here, the value and location stacks
834 have just been pushed. so pushing a state here evens the stacks.
841 if (yyss
+ yystacksize
- 1 <= yyssp
)
843 /* Get the current used size of the three stacks, in elements. */
844 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
848 /* Give user a chance to reallocate the stack. Use copies of
849 these so that the &'s don't force the real ones into
851 YYSTYPE
*yyvs1
= yyvs
;
853 ]b4_location_if([ YYLTYPE
*yyls1
= yyls
;])[
855 /* Each stack pointer address is followed by the size of the
856 data in use in that stack, in bytes. This used to be a
857 conditional around just the two extra args, but that might
858 be undefined if yyoverflow is a macro. */
859 yyoverflow ("parser stack overflow",
860 &yyss1
, yysize
* sizeof (*yyssp
),
861 &yyvs1
, yysize
* sizeof (*yyvsp
),
862 ]b4_location_if([ &yyls1
, yysize
* sizeof (*yylsp
),])[
864 ]b4_location_if([ yyls
= yyls1
;])[
868 #else /* no yyoverflow */
869 # ifndef YYSTACK_RELOCATE
872 /* Extend the stack our own way. */
873 if (YYMAXDEPTH
<= yystacksize
)
876 if (YYMAXDEPTH
< yystacksize
)
877 yystacksize
= YYMAXDEPTH
;
881 union yyalloc
*yyptr
=
882 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
885 YYSTACK_RELOCATE (yyss
);
886 YYSTACK_RELOCATE (yyvs
);
887 ]b4_location_if([ YYSTACK_RELOCATE (yyls
);])[
888 # undef YYSTACK_RELOCATE
890 YYSTACK_FREE (yyss1
);
893 #endif /* no yyoverflow */
895 yyssp
= yyss
+ yysize
- 1;
896 yyvsp
= yyvs
+ yysize
- 1;
897 ]b4_location_if([ yylsp
= yyls
+ yysize
- 1;])[
899 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
900 (unsigned long int) yystacksize
));
902 if (yyss
+ yystacksize
- 1 <= yyssp
)
906 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
915 /* Do appropriate processing given the current state. */
916 /* Read a lookahead token if we need one and don't already have one. */
919 /* First try to decide what to do without reference to lookahead token. */
921 yyn
= yypact
[yystate
];
922 if (yyn
== YYPACT_NINF
)
925 /* Not known => get a lookahead token if don't already have one. */
927 /* yychar is either YYEMPTY or YYEOF
928 or a valid token in external form. */
930 if (yychar
== YYEMPTY
)
932 YYDPRINTF ((stderr
, "Reading a token: "));
936 /* Convert token to internal form (in yychar1) for indexing tables with. */
938 if (yychar
<= 0) /* This means end of input. */
941 yychar
= YYEOF
; /* Don't call YYLEX any more. */
943 YYDPRINTF ((stderr
, "Now at end of input.\n"));
947 yychar1
= YYTRANSLATE (yychar
);
949 /* We have to keep this `#if YYDEBUG', since we use variables
950 which are defined only if `YYDEBUG' is set. */
951 YYDPRINTF ((stderr
, "Next token is "));
952 YYDSYMPRINT ((stderr
, yychar1
, yylval
]b4_location_if([, yyloc
])[));
953 YYDPRINTF ((stderr
, "\n"));
956 /* If the proper action on seeing token YYCHAR1 is to reduce or to
957 detect an error, take that action. */
959 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yychar1
)
964 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
973 /* Shift the lookahead token. */
974 YYDPRINTF ((stderr
, "Shifting token %d (%s), ",
975 yychar
, yytname
[yychar1
]));
977 /* Discard the token being shifted unless it is eof. */
982 ]b4_location_if([ *++yylsp
= yylloc
;])[
984 /* Count tokens shifted since error; after three, turn off error
993 /*-----------------------------------------------------------.
994 | yydefault -- do the default action for the current state. |
995 `-----------------------------------------------------------*/
997 yyn
= yydefact
[yystate
];
1003 /*-----------------------------.
1004 | yyreduce -- Do a reduction. |
1005 `-----------------------------*/
1007 /* yyn is the number of a rule to reduce with. */
1010 /* If YYLEN is nonzero, implement the default value of the action:
1013 Otherwise, the following line sets YYVAL to garbage.
1014 This behavior is undocumented and Bison
1015 users should not rely upon it. Assigning to YYVAL
1016 unconditionally makes the parser a bit smaller, and it avoids a
1017 GCC warning that YYVAL may be used uninitialized. */
1018 yyval
= yyvsp
[1-yylen
];
1021 [ /* Default location. */
1022 YYLLOC_DEFAULT (yyloc
, (yylsp
- yylen
), yylen
);])[
1025 /* We have to keep this `#if YYDEBUG', since we use variables which
1026 are defined only if `YYDEBUG' is set. */
1031 YYFPRINTF (stderr
, "Reducing via rule %d (line %d), ",
1032 yyn
- 1, yyrline
[yyn
]);
1034 /* Print the symbols being reduced, and their result. */
1035 for (yyi
= yyprhs
[yyn
]; 0 <= yyrhs
[yyi
]; yyi
++)
1036 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1037 YYFPRINTF (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1045 /* Line __line__ of __file__. */
1046 #line __oline__ "__ofile__"
1050 ]b4_location_if([ yylsp
-= yylen
;])[
1055 short *yyssp1
= yyss
- 1;
1056 YYFPRINTF (stderr
, "state stack now");
1057 while (yyssp1
!= yyssp
)
1058 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1059 YYFPRINTF (stderr
, "\n");
1064 ]b4_location_if([ *++yylsp
= yyloc
;])[
1066 /* Now `shift' the result of the reduction. Determine what state
1067 that goes to, based on the state we popped back to and the rule
1068 number reduced by. */
1072 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1073 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1074 yystate
= yytable
[yystate
];
1076 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1081 /*------------------------------------.
1082 | yyerrlab -- here on detecting error |
1083 `------------------------------------*/
1085 /* If not already recovering from an error, report this error. */
1090 yyn
= yypact
[yystate
];
1092 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1094 YYSIZE_T yysize
= 0;
1095 int yytype
= YYTRANSLATE (yychar
);
1100 /* Start YYX at -YYN if negative to avoid negative indexes in
1102 for (yyx
= yyn
< 0 ? -yyn
: 0;
1103 yyx
< (int) (sizeof (yytname
) / sizeof (char *)); yyx
++)
1104 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1105 yysize
+= yystrlen (yytname
[yyx
]) + 15, yycount
++;
1106 yysize
+= yystrlen ("parse error, unexpected ") + 1;
1107 yysize
+= yystrlen (yytname
[yytype
]);
1108 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1111 char *yyp
= yystpcpy (yymsg
, "parse error, unexpected ");
1112 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1117 for (yyx
= yyn
< 0 ? -yyn
: 0;
1118 yyx
< (int) (sizeof (yytname
) / sizeof (char *));
1120 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1122 const char *yyq
= ! yycount
? ", expecting " : " or ";
1123 yyp
= yystpcpy (yyp
, yyq
);
1124 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1129 YYSTACK_FREE (yymsg
);
1132 yyerror ("parse error; also virtual memory exhausted");
1135 #endif /* YYERROR_VERBOSE */
1136 yyerror ("parse error");
1141 /*----------------------------------------------------.
1142 | yyerrlab1 -- error raised explicitly by an action. |
1143 `----------------------------------------------------*/
1145 if (yyerrstatus
== 3)
1147 /* If just tried and failed to reuse lookahead token after an
1148 error, discard it. */
1150 /* Return failure if at end of input. */
1151 if (yychar
== YYEOF
)
1153 /* Pop the error token. */
1155 /* Pop the rest of the stack. */
1156 while (yyss
< yyssp
)
1158 YYDPRINTF ((stderr
, "Error: popping "));
1159 YYDSYMPRINT ((stderr
,
1161 *yyvsp
]b4_location_if([, *yylsp
])[));
1162 YYDPRINTF ((stderr
, "\n"));
1163 yydestruct (yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[);
1169 YYDPRINTF ((stderr
, "Discarding token %d (%s).\n",
1170 yychar
, yytname
[yychar1
]));
1171 yydestruct (yychar1
, yylval
]b4_location_if([, yylloc
])[);
1175 /* Else will try to reuse lookahead token after shifting the error
1178 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1182 yyn
= yypact
[yystate
];
1183 if (yyn
!= YYPACT_NINF
)
1186 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1194 /* Pop the current state because it cannot handle the error token. */
1198 YYDPRINTF ((stderr
, "Error: popping "));
1199 YYDSYMPRINT ((stderr
,
1200 yystos
[*yyssp
], *yyvsp
]b4_location_if([, *yylsp
])[));
1201 YYDPRINTF ((stderr
, "\n"));
1203 yydestruct (yystos
[yystate
], *yyvsp
]b4_location_if([, *yylsp
])[);
1206 ]b4_location_if([ yylsp
--;])[
1211 short *yyssp1
= yyss
- 1;
1212 YYFPRINTF (stderr
, "Error: state stack now");
1213 while (yyssp1
!= yyssp
)
1214 YYFPRINTF (stderr
, " %d", *++yyssp1
);
1215 YYFPRINTF (stderr
, "\n");
1223 YYDPRINTF ((stderr
, "Shifting error token, "));
1226 ]b4_location_if([ *++yylsp
= yylloc
;])[
1232 /*-------------------------------------.
1233 | yyacceptlab -- YYACCEPT comes here. |
1234 `-------------------------------------*/
1239 /*-----------------------------------.
1240 | yyabortlab -- YYABORT comes here. |
1241 `-----------------------------------*/
1247 /*----------------------------------------------.
1248 | yyoverflowlab -- parser overflow comes here. |
1249 `----------------------------------------------*/
1251 yyerror ("parser stack overflow");
1259 YYSTACK_FREE (yyss
);
1266 m4_if(b4_defines_flag
, 0, [],
1267 [#output "b4_output_header_name"
1268 b4_copyright([Skeleton parser
for Yacc
-like parsing with Bison
],
1269 [1984, 1989, 1990, 2000, 2001, 2002])
1271 /* As a special exception, when this file is copied by Bison into a
1272 Bison output file, you may use that output file without restriction.
1273 This special exception was added by the Free Software Foundation
1274 in version 1.24 of Bison. */
1276 #ifndef b4_header_guard
1277 # define b4_header_guard
1279 b4_token_defines(b4_tokens
)
1282 m4_ifdef([b4_stype
],
1283 [#line b4_stype_line "b4_filename"
1284 typedef union b4_stype yystype
;
1285 /* Line __line__ of __file__. */
1286 #line __oline__ "__ofile__"],
1287 [typedef int yystype
;])
1288 # define YYSTYPE yystype
1292 [extern YYSTYPE b4_prefix
[]lval
;])
1296 typedef struct yyltype
1303 # define YYLTYPE yyltype
1307 [extern YYLTYPE b4_prefix
[]lloc
;])
1309 #endif /* not b4_header_guard */