]>
Commit | Line | Data |
---|---|---|
007a50a4 | 1 | m4_divert(-1) -*- C -*- |
fb8135fa | 2 | m4_include([c.m4]) |
a8289c62 | 3 | |
60491a94 | 4 | # Yacc compatible skeleton for Bison |
12b0043a AD |
5 | # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 |
6 | # Free Software Foundation, Inc. | |
60491a94 AD |
7 | |
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. | |
12 | ||
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. | |
17 | ||
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 | |
21 | # 02111-1307 USA | |
22 | ||
66d30cd4 AD |
23 | |
24 | ||
25 | ## ---------------- ## | |
26 | ## Default values. ## | |
27 | ## ---------------- ## | |
28 | ||
29 | # Stack parameters. | |
30 | m4_define_default([b4_stack_depth_max], [10000]) | |
31 | m4_define_default([b4_stack_depth_init], [200]) | |
32 | ||
33 | # Location type. | |
34 | m4_define_default([b4_location_type], [yyltype]) | |
35 | ||
21964f43 AD |
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))) | |
66d30cd4 | 42 | |
0245f82d AD |
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], | |
47 | b4_parse_param)]) | |
48 | ||
66d30cd4 AD |
49 | |
50 | ## ----------------- ## | |
51 | ## Semantic Values. ## | |
52 | ## ----------------- ## | |
53 | ||
54 | ||
82b6cb3f AD |
55 | # b4_lhs_value([TYPE]) |
56 | # -------------------- | |
57 | # Expansion of $<TYPE>$. | |
58 | m4_define([b4_lhs_value], | |
59 | [yyval[]m4_ifval([$1], [.$1])]) | |
60 | ||
61 | ||
62 | # b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) | |
63 | # -------------------------------------- | |
64 | # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH | |
65 | # symbols on RHS. | |
66 | m4_define([b4_rhs_value], | |
67 | [yyvsp@<:@m4_eval([$2 - $1])@:>@m4_ifval([$3], [.$3])]) | |
68 | ||
69 | ||
58612f1d AD |
70 | |
71 | ## ----------- ## | |
72 | ## Locations. ## | |
73 | ## ----------- ## | |
74 | ||
82b6cb3f AD |
75 | # b4_lhs_location() |
76 | # ----------------- | |
77 | # Expansion of @$. | |
78 | m4_define([b4_lhs_location], | |
79 | [yyloc]) | |
80 | ||
81 | ||
82 | # b4_rhs_location(RULE-LENGTH, NUM) | |
83 | # --------------------------------- | |
84 | # Expansion of @NUM, where the current rule has RULE-LENGTH symbols | |
85 | # on RHS. | |
86 | m4_define([b4_rhs_location], | |
87 | [yylsp@<:@m4_eval([$2 - $1])@:>@]) | |
88 | ||
89 | ||
58612f1d AD |
90 | |
91 | ## ------------------- ## | |
92 | ## Output file names. ## | |
93 | ## ------------------- ## | |
94 | ||
be2a1a68 | 95 | m4_define_default([b4_input_suffix], [.y]) |
2992e1e9 | 96 | |
be2a1a68 AD |
97 | m4_define_default([b4_output_parser_suffix], |
98 | [m4_translit(b4_input_suffix, [yY], [cC])]) | |
99 | ||
100 | m4_define_default([b4_output_parser_name], | |
101 | [b4_output_prefix[]b4_output_infix[]b4_output_parser_suffix[]]) | |
102 | ||
103 | ||
104 | m4_define_default([b4_output_header_suffix], | |
105 | [m4_translit(b4_input_suffix, [yY], [hH])]) | |
106 | ||
107 | m4_define_default([b4_output_header_name], | |
108 | [b4_output_prefix[]b4_output_infix[]b4_output_header_suffix[]]) | |
109 | ||
110 | m4_define_default([b4_header_guard], | |
111 | [m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name), | |
112 | [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])]) | |
113 | ||
0d8bed56 | 114 | |
0d8bed56 | 115 | |
1ae72863 AD |
116 | ## --------------------------------------------------------- ## |
117 | ## Defining symbol actions, e.g., printers and destructors. ## | |
118 | ## --------------------------------------------------------- ## | |
119 | ||
120 | # b4_symbol_actions(FILENAME, LINENO, | |
121 | # SYMBOL-TAG, SYMBOL-NUM, | |
122 | # SYMBOL-ACTION, SYMBOL-TYPENAME) | |
123 | # ------------------------------------------------- | |
124 | m4_define([b4_symbol_actions], | |
125 | [m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl | |
126 | m4_pushdef([b4_at_dollar], [yylocation])dnl | |
127 | case $4: /* $3 */ | |
128 | #line $2 "$1" | |
129 | $5; | |
130 | #line __oline__ "__ofile__" | |
131 | break; | |
132 | m4_popdef([b4_at_dollar])dnl | |
133 | m4_popdef([b4_dollar_dollar])dnl | |
134 | ]) | |
135 | ||
136 | ||
137 | ||
be2a1a68 AD |
138 | m4_divert(0)dnl |
139 | #output "b4_output_parser_name" | |
fb8135fa AD |
140 | b4_copyright([Skeleton parser for Yacc-like parsing with Bison], |
141 | [1984, 1989, 1990, 2000, 2001, 2002]) | |
142 | ||
0252b55c PE |
143 | /* As a special exception, when this file is copied by Bison into a |
144 | Bison output file, you may use that output file without restriction. | |
145 | This special exception was added by the Free Software Foundation | |
146 | in version 1.24 of Bison. */ | |
147 | ||
fb8135fa AD |
148 | /* Written by Richard Stallman by simplifying the original so called |
149 | ``semantic'' parser. */ | |
444fbf65 | 150 | |
cf44a9ae PE |
151 | /* All symbols defined below should begin with yy or YY, to avoid |
152 | infringing on user name space. This should be done even for local | |
153 | variables, as they might otherwise be expanded by user macros. | |
154 | There are some unavoidable exceptions within include files to | |
155 | define necessary library symbols; they are noted "INFRINGES ON | |
156 | USER NAME SPACE" below. */ | |
157 | ||
7093d0f5 AD |
158 | /* Identify Bison output. */ |
159 | #define YYBISON 1 | |
fd51e5ff | 160 | |
7093d0f5 | 161 | /* Pure parsers. */ |
be2a1a68 | 162 | #define YYPURE b4_pure |
7093d0f5 AD |
163 | |
164 | /* Using locations. */ | |
be2a1a68 | 165 | #define YYLSP_NEEDED b4_locations_flag |
7093d0f5 | 166 | |
be2a1a68 AD |
167 | m4_if(b4_prefix[], [yy], [], |
168 | [/* If NAME_PREFIX is specified substitute the variables and functions | |
17da6427 | 169 | names. */ |
be2a1a68 AD |
170 | #define yyparse b4_prefix[]parse |
171 | #define yylex b4_prefix[]lex | |
172 | #define yyerror b4_prefix[]error | |
173 | #define yylval b4_prefix[]lval | |
174 | #define yychar b4_prefix[]char | |
175 | #define yydebug b4_prefix[]debug | |
176 | #define yynerrs b4_prefix[]nerrs | |
58612f1d | 177 | b4_location_if([#define yylloc b4_prefix[]lloc])]) |
17da6427 | 178 | |
17acead5 PE |
179 | b4_token_defines(b4_tokens) |
180 | ||
0dd1580a RA |
181 | /* Copy the first part of user declarations. */ |
182 | b4_pre_prologue | |
cce71710 | 183 | |
d99361e6 AD |
184 | /* Enabling traces. */ |
185 | #ifndef YYDEBUG | |
be2a1a68 | 186 | # define YYDEBUG b4_debug |
d99361e6 AD |
187 | #endif |
188 | ||
189 | /* Enabling verbose error messages. */ | |
190 | #ifdef YYERROR_VERBOSE | |
191 | # undef YYERROR_VERBOSE | |
192 | # define YYERROR_VERBOSE 1 | |
193 | #else | |
be2a1a68 | 194 | # define YYERROR_VERBOSE b4_error_verbose |
d99361e6 AD |
195 | #endif |
196 | ||
fd51e5ff | 197 | #ifndef YYSTYPE |
e9955c83 | 198 | m4_ifdef([b4_stype], |
642cb8f8 | 199 | [#line b4_stype_line "b4_filename" |
e96c9728 AD |
200 | typedef union b4_stype yystype; |
201 | /* Line __line__ of __file__. */ | |
202 | #line __oline__ "__ofile__"], | |
e9955c83 | 203 | [typedef int yystype;]) |
fd51e5ff | 204 | # define YYSTYPE yystype |
71cd15d4 | 205 | # define YYSTYPE_IS_TRIVIAL 1 |
fd51e5ff AD |
206 | #endif |
207 | ||
208 | #ifndef YYLTYPE | |
209 | typedef struct yyltype | |
210 | { | |
211 | int first_line; | |
212 | int first_column; | |
213 | int last_line; | |
214 | int last_column; | |
215 | } yyltype; | |
66d30cd4 | 216 | # define YYLTYPE b4_location_type |
71cd15d4 | 217 | # define YYLTYPE_IS_TRIVIAL 1 |
fd51e5ff AD |
218 | #endif |
219 | ||
0dd1580a RA |
220 | /* Copy the second part of user declarations. */ |
221 | b4_post_prologue | |
222 | ||
be2a1a68 | 223 | /* Line __line__ of __file__. */ |
06446ccf | 224 | #line __oline__ "__ofile__" |
7093d0f5 | 225 | |
cf44a9ae | 226 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
7093d0f5 AD |
227 | |
228 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | |
229 | ||
230 | # if YYSTACK_USE_ALLOCA | |
231 | # define YYSTACK_ALLOC alloca | |
7093d0f5 AD |
232 | # else |
233 | # ifndef YYSTACK_USE_ALLOCA | |
234 | # if defined (alloca) || defined (_ALLOCA_H) | |
235 | # define YYSTACK_ALLOC alloca | |
7093d0f5 | 236 | # else |
0d8a7363 | 237 | # ifdef __GNUC__ |
7093d0f5 AD |
238 | # define YYSTACK_ALLOC __builtin_alloca |
239 | # endif | |
7093d0f5 AD |
240 | # endif |
241 | # endif | |
242 | # endif | |
243 | ||
244 | # ifdef YYSTACK_ALLOC | |
245 | /* Pacify GCC's `empty if-body' warning. */ | |
246 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | |
247 | # else | |
45119af1 PE |
248 | # if defined (__STDC__) || defined (__cplusplus) |
249 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | |
250 | # define YYSIZE_T size_t | |
7093d0f5 | 251 | # endif |
45119af1 PE |
252 | # define YYSTACK_ALLOC malloc |
253 | # define YYSTACK_FREE free | |
7093d0f5 | 254 | # endif |
cf44a9ae PE |
255 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
256 | ||
257 | ||
258 | #if (! defined (yyoverflow) \ | |
259 | && (! defined (__cplusplus) \ | |
260 | || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | |
7093d0f5 | 261 | |
600f9b0c PE |
262 | /* A type that is properly aligned for any stack member. */ |
263 | union yyalloc | |
264 | { | |
2729e106 PE |
265 | short yyss; |
266 | YYSTYPE yyvs; | |
58612f1d AD |
267 | b4_location_if([ YYLTYPE yyls; |
268 | ])dnl | |
600f9b0c PE |
269 | }; |
270 | ||
271 | /* The size of the maximum gap between one aligned stack and the next. */ | |
7093d0f5 | 272 | # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) |
600f9b0c PE |
273 | |
274 | /* The size of an array large to enough to hold all stacks, each with | |
275 | N elements. */ | |
58612f1d AD |
276 | b4_location_if( |
277 | [# define YYSTACK_BYTES(N) \ | |
cf44a9ae | 278 | ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ |
58612f1d AD |
279 | + 2 * YYSTACK_GAP_MAX)], |
280 | [# define YYSTACK_BYTES(N) \ | |
cf44a9ae | 281 | ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ |
58612f1d | 282 | + YYSTACK_GAP_MAX)]) |
600f9b0c | 283 | |
5b041382 PE |
284 | /* Copy COUNT objects from FROM to TO. The source and destination do |
285 | not overlap. */ | |
286 | # ifndef YYCOPY | |
287 | # if 1 < __GNUC__ | |
288 | # define YYCOPY(To, From, Count) \ | |
289 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | |
290 | # else | |
291 | # define YYCOPY(To, From, Count) \ | |
292 | do \ | |
293 | { \ | |
294 | register YYSIZE_T yyi; \ | |
295 | for (yyi = 0; yyi < (Count); yyi++) \ | |
0c76a0c9 | 296 | (To)[[yyi]] = (From)[[yyi]]; \ |
5b041382 PE |
297 | } \ |
298 | while (0) | |
299 | # endif | |
300 | # endif | |
301 | ||
302 | /* Relocate STACK from its old location to the new one. The | |
7093d0f5 | 303 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
600f9b0c PE |
304 | elements in the stack, and YYPTR gives the new location of the |
305 | stack. Advance YYPTR to a properly aligned location for the next | |
306 | stack. */ | |
5b041382 | 307 | # define YYSTACK_RELOCATE(Stack) \ |
7093d0f5 AD |
308 | do \ |
309 | { \ | |
310 | YYSIZE_T yynewbytes; \ | |
5b041382 | 311 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
2729e106 | 312 | Stack = &yyptr->Stack; \ |
5b041382 | 313 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ |
2729e106 | 314 | yyptr += yynewbytes / sizeof (*yyptr); \ |
7093d0f5 AD |
315 | } \ |
316 | while (0) | |
317 | ||
cf44a9ae | 318 | #endif |
8850be4b | 319 | |
768eb43f PE |
320 | #if defined (__STDC__) || defined (__cplusplus) |
321 | typedef signed char yysigned_char; | |
322 | #else | |
323 | typedef short yysigned_char; | |
324 | #endif | |
325 | ||
7742ddeb | 326 | /* YYFINAL -- State number of the termination state. */ |
7db2ed2d | 327 | #define YYFINAL b4_final_state_number |
39912f52 | 328 | /* YYLAST -- Last index in YYTABLE. */ |
be2a1a68 | 329 | #define YYLAST b4_last |
7742ddeb AD |
330 | |
331 | /* YYNTOKENS -- Number of terminals. */ | |
7db2ed2d | 332 | #define YYNTOKENS b4_tokens_number |
7742ddeb | 333 | /* YYNNTS -- Number of nonterminals. */ |
7db2ed2d | 334 | #define YYNNTS b4_nterms_number |
7742ddeb | 335 | /* YYNRULES -- Number of rules. */ |
7db2ed2d | 336 | #define YYNRULES b4_rules_number |
7742ddeb | 337 | /* YYNRULES -- Number of states. */ |
7db2ed2d | 338 | #define YYNSTATES b4_states_number |
7742ddeb AD |
339 | |
340 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | |
007a50a4 AD |
341 | #define YYUNDEFTOK b4_undef_token_number |
342 | #define YYMAXUTOK b4_user_token_number_max | |
343 | ||
007a50a4 AD |
344 | #define YYTRANSLATE(X) \ |
345 | ((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK) | |
a8289c62 | 346 | |
be2a1a68 | 347 | /* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */ |
a762e609 | 348 | static const b4_int_type_for([b4_translate]) yytranslate[[]] = |
a8289c62 | 349 | { |
be2a1a68 | 350 | b4_translate |
a8289c62 RA |
351 | }; |
352 | ||
353 | #if YYDEBUG | |
be2a1a68 | 354 | /* YYPRHS[[YYN]] -- Index of the first RHS symbol of rule number YYN in |
7742ddeb | 355 | YYRHS. */ |
a762e609 | 356 | static const b4_int_type_for([b4_prhs]) yyprhs[[]] = |
a8289c62 | 357 | { |
be2a1a68 | 358 | b4_prhs |
a8289c62 RA |
359 | }; |
360 | ||
3db472b9 | 361 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
a762e609 | 362 | static const b4_int_type_for([b4_rhs]) yyrhs[[]] = |
a8289c62 | 363 | { |
be2a1a68 | 364 | b4_rhs |
a8289c62 RA |
365 | }; |
366 | ||
be2a1a68 | 367 | /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */ |
a762e609 | 368 | static const b4_int_type_for([b4_rline]) yyrline[[]] = |
a8289c62 | 369 | { |
be2a1a68 | 370 | b4_rline |
a8289c62 RA |
371 | }; |
372 | #endif | |
373 | ||
5504898e | 374 | #if YYDEBUG || YYERROR_VERBOSE |
be2a1a68 | 375 | /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM. |
7742ddeb | 376 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
be2a1a68 | 377 | static const char *const yytname[[]] = |
a8289c62 | 378 | { |
be2a1a68 | 379 | b4_tname |
a8289c62 RA |
380 | }; |
381 | #endif | |
382 | ||
c0ad8bf3 | 383 | # ifdef YYPRINT |
769b430f AD |
384 | /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to |
385 | token YYLEX-NUM. */ | |
a762e609 | 386 | static const b4_int_type_for([b4_toknum]) yytoknum[[]] = |
a8289c62 | 387 | { |
be2a1a68 | 388 | b4_toknum |
a8289c62 | 389 | }; |
c0ad8bf3 | 390 | # endif |
a8289c62 | 391 | |
be2a1a68 | 392 | /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */ |
a762e609 | 393 | static const b4_int_type_for([b4_r1]) yyr1[[]] = |
a8289c62 | 394 | { |
be2a1a68 | 395 | b4_r1 |
a8289c62 RA |
396 | }; |
397 | ||
be2a1a68 | 398 | /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */ |
a762e609 | 399 | static const b4_int_type_for([b4_r2]) yyr2[[]] = |
a8289c62 | 400 | { |
be2a1a68 | 401 | b4_r2 |
a8289c62 RA |
402 | }; |
403 | ||
5504898e AD |
404 | /* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state |
405 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | |
406 | means the default is an error. */ | |
a762e609 | 407 | static const b4_int_type_for([b4_defact]) yydefact[[]] = |
a8289c62 | 408 | { |
be2a1a68 | 409 | b4_defact |
a8289c62 RA |
410 | }; |
411 | ||
12b0043a | 412 | /* YYDEFGOTO[[NTERM-NUM]]. */ |
a762e609 | 413 | static const b4_int_type_for([b4_defgoto]) yydefgoto[[]] = |
a8289c62 | 414 | { |
be2a1a68 | 415 | b4_defgoto |
a8289c62 RA |
416 | }; |
417 | ||
be2a1a68 | 418 | /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing |
7742ddeb | 419 | STATE-NUM. */ |
12b0043a | 420 | #define YYPACT_NINF b4_pact_ninf |
a762e609 | 421 | static const b4_int_type_for([b4_pact]) yypact[[]] = |
a8289c62 | 422 | { |
be2a1a68 | 423 | b4_pact |
a8289c62 RA |
424 | }; |
425 | ||
be2a1a68 | 426 | /* YYPGOTO[[NTERM-NUM]]. */ |
a762e609 | 427 | static const b4_int_type_for([b4_pgoto]) yypgoto[[]] = |
a8289c62 | 428 | { |
be2a1a68 | 429 | b4_pgoto |
a8289c62 RA |
430 | }; |
431 | ||
be2a1a68 | 432 | /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If |
7742ddeb | 433 | positive, shift that token. If negative, reduce the rule which |
f50adbbd AD |
434 | number is the opposite. If zero, do what YYDEFACT says. |
435 | If YYTABLE_NINF, parse error. */ | |
12b0043a | 436 | #define YYTABLE_NINF b4_table_ninf |
a762e609 | 437 | static const b4_int_type_for([b4_table]) yytable[[]] = |
a8289c62 | 438 | { |
be2a1a68 | 439 | b4_table |
a8289c62 RA |
440 | }; |
441 | ||
a762e609 | 442 | static const b4_int_type_for([b4_check]) yycheck[[]] = |
a8289c62 | 443 | { |
be2a1a68 | 444 | b4_check |
a8289c62 RA |
445 | }; |
446 | ||
5504898e AD |
447 | /* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing |
448 | symbol of state STATE-NUM. */ | |
a762e609 | 449 | static const b4_int_type_for([b4_stos]) yystos[[]] = |
5504898e AD |
450 | { |
451 | b4_stos | |
452 | }; | |
7093d0f5 AD |
453 | |
454 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | |
455 | # define YYSIZE_T __SIZE_TYPE__ | |
456 | #endif | |
457 | #if ! defined (YYSIZE_T) && defined (size_t) | |
458 | # define YYSIZE_T size_t | |
459 | #endif | |
b7575ffe | 460 | #if ! defined (YYSIZE_T) |
45119af1 PE |
461 | # if defined (__STDC__) || defined (__cplusplus) |
462 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | |
463 | # define YYSIZE_T size_t | |
b7575ffe | 464 | # endif |
7093d0f5 AD |
465 | #endif |
466 | #if ! defined (YYSIZE_T) | |
467 | # define YYSIZE_T unsigned int | |
468 | #endif | |
469 | ||
10fa2066 | 470 | #define yyerrok (yyerrstatus = 0) |
17da6427 | 471 | #define yyclearin (yychar = YYEMPTY) |
10fa2066 RS |
472 | #define YYEMPTY -2 |
473 | #define YYEOF 0 | |
a8289c62 | 474 | |
70ddf897 | 475 | #define YYACCEPT goto yyacceptlab |
a8289c62 | 476 | #define YYABORT goto yyabortlab |
10fa2066 | 477 | #define YYERROR goto yyerrlab1 |
a8289c62 | 478 | |
71da9eea AD |
479 | /* Like YYERROR except do call yyerror. This remains here temporarily |
480 | to ease the transition to the new meaning of YYERROR, for GCC. | |
10fa2066 | 481 | Once GCC version 2 has supplanted version 1, this can go. */ |
a8289c62 | 482 | |
10fa2066 | 483 | #define YYFAIL goto yyerrlab |
a8289c62 | 484 | |
10fa2066 | 485 | #define YYRECOVERING() (!!yyerrstatus) |
a8289c62 | 486 | |
69b4e0c5 | 487 | #define YYBACKUP(Token, Value) \ |
10fa2066 | 488 | do \ |
17da6427 | 489 | if (yychar == YYEMPTY && yylen == 1) \ |
71da9eea | 490 | { \ |
17da6427 | 491 | yychar = (Token); \ |
7742ddeb | 492 | yylval = (Value); \ |
17da6427 | 493 | yychar1 = YYTRANSLATE (yychar); \ |
10fa2066 RS |
494 | YYPOPSTACK; \ |
495 | goto yybackup; \ | |
496 | } \ | |
497 | else \ | |
71da9eea | 498 | { \ |
7742ddeb | 499 | yyerror ("syntax error: cannot back up"); \ |
71da9eea AD |
500 | YYERROR; \ |
501 | } \ | |
10fa2066 RS |
502 | while (0) |
503 | ||
504 | #define YYTERROR 1 | |
505 | #define YYERRCODE 256 | |
506 | ||
3abcd459 | 507 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
b2d52318 | 508 | are run). */ |
3abcd459 AD |
509 | |
510 | #ifndef YYLLOC_DEFAULT | |
b2d52318 AD |
511 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
512 | Current.first_line = Rhs[[1]].first_line; \ | |
513 | Current.first_column = Rhs[[1]].first_column; \ | |
514 | Current.last_line = Rhs[[N]].last_line; \ | |
515 | Current.last_column = Rhs[[N]].last_column; | |
3abcd459 AD |
516 | #endif |
517 | ||
3abcd459 | 518 | /* YYLEX -- calling `yylex' with the right arguments. */ |
553e2b22 | 519 | |
ae7453f2 AD |
520 | #ifdef YYLEX_PARAM |
521 | # define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM) | |
74310291 | 522 | #else |
21964f43 | 523 | # define YYLEX b4_c_function_call([yylex], [int], b4_lex_param) |
ae7453f2 | 524 | #endif |
553e2b22 | 525 | |
5a35a6cb | 526 | /* Enable debugging if requested. */ |
0d533154 | 527 | #if YYDEBUG |
b7575ffe PE |
528 | |
529 | # ifndef YYFPRINTF | |
45119af1 PE |
530 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
531 | # define YYFPRINTF fprintf | |
b7575ffe PE |
532 | # endif |
533 | ||
5a35a6cb AD |
534 | # define YYDPRINTF(Args) \ |
535 | do { \ | |
17da6427 | 536 | if (yydebug) \ |
b7575ffe | 537 | YYFPRINTF Args; \ |
5a35a6cb | 538 | } while (0) |
253862fd AD |
539 | # define YYDSYMPRINT(Args) \ |
540 | do { \ | |
541 | if (yydebug) \ | |
542 | yysymprint Args; \ | |
543 | } while (0) | |
cf44a9ae PE |
544 | /* Nonzero means print parse trace. It is left uninitialized so that |
545 | multiple parsers can coexist. */ | |
17da6427 | 546 | int yydebug; |
5a35a6cb AD |
547 | #else /* !YYDEBUG */ |
548 | # define YYDPRINTF(Args) | |
253862fd | 549 | # define YYDSYMPRINT(Args) |
5a35a6cb AD |
550 | #endif /* !YYDEBUG */ |
551 | ||
552 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | |
10fa2066 | 553 | #ifndef YYINITDEPTH |
66d30cd4 | 554 | # define YYINITDEPTH b4_stack_depth_init |
10fa2066 RS |
555 | #endif |
556 | ||
5a35a6cb | 557 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
600f9b0c PE |
558 | if the built-in stack extension method is used). |
559 | ||
560 | Do not make this value too large; the results are undefined if | |
561 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) | |
562 | evaluated with infinite-precision integer arithmetic. */ | |
563 | ||
10fa2066 | 564 | #if YYMAXDEPTH == 0 |
b07b484a | 565 | # undef YYMAXDEPTH |
10fa2066 RS |
566 | #endif |
567 | ||
568 | #ifndef YYMAXDEPTH | |
66d30cd4 | 569 | # define YYMAXDEPTH b4_stack_depth_max |
10fa2066 | 570 | #endif |
a8289c62 | 571 | |
10fa2066 | 572 | \f |
a8289c62 | 573 | |
7093d0f5 AD |
574 | #if YYERROR_VERBOSE |
575 | ||
576 | # ifndef yystrlen | |
577 | # if defined (__GLIBC__) && defined (_STRING_H) | |
578 | # define yystrlen strlen | |
579 | # else | |
580 | /* Return the length of YYSTR. */ | |
581 | static YYSIZE_T | |
582 | # if defined (__STDC__) || defined (__cplusplus) | |
583 | yystrlen (const char *yystr) | |
584 | # else | |
585 | yystrlen (yystr) | |
586 | const char *yystr; | |
587 | # endif | |
588 | { | |
589 | register const char *yys = yystr; | |
590 | ||
591 | while (*yys++ != '\0') | |
592 | continue; | |
593 | ||
594 | return yys - yystr - 1; | |
595 | } | |
596 | # endif | |
597 | # endif | |
598 | ||
599 | # ifndef yystpcpy | |
600 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | |
601 | # define yystpcpy stpcpy | |
602 | # else | |
603 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | |
604 | YYDEST. */ | |
605 | static char * | |
f11966ff PE |
606 | # if defined (__STDC__) || defined (__cplusplus) |
607 | yystpcpy (char *yydest, const char *yysrc) | |
608 | # else | |
7093d0f5 AD |
609 | yystpcpy (yydest, yysrc) |
610 | char *yydest; | |
611 | const char *yysrc; | |
7093d0f5 AD |
612 | # endif |
613 | { | |
614 | register char *yyd = yydest; | |
615 | register const char *yys = yysrc; | |
616 | ||
617 | while ((*yyd++ = *yys++) != '\0') | |
618 | continue; | |
619 | ||
620 | return yyd - 1; | |
621 | } | |
622 | # endif | |
623 | # endif | |
624 | ||
625 | #endif /* !YYERROR_VERBOSE */ | |
626 | ||
10fa2066 | 627 | \f |
a8289c62 | 628 | |
b8df3223 AD |
629 | #if YYDEBUG |
630 | /*-----------------------------. | |
631 | | Print this symbol on YYOUT. | | |
632 | `-----------------------------*/ | |
633 | ||
0245f82d AD |
634 | b4_c_function_def([yysymprint], |
635 | [static void], | |
636 | [[FILE *yyout], [yyout]], | |
637 | [[int yytype], [yytype]], | |
638 | [[YYSTYPE yyvalue], [yyvalue]]b4_location_if([, | |
639 | [[YYLTYPE yylocation], [yylocation]]])) | |
b8df3223 AD |
640 | { |
641 | /* Pacify ``unused variable'' warnings. */ | |
642 | (void) yyvalue; | |
643 | b4_location_if([ (void) yylocation; | |
644 | ])dnl | |
645 | ||
646 | if (yytype < YYNTOKENS) | |
647 | { | |
648 | YYFPRINTF (yyout, "token %s (", yytname[[yytype]]); | |
649 | # ifdef YYPRINT | |
650 | YYPRINT (yyout, yytoknum[[yytype]], yyvalue); | |
366eea36 | 651 | # endif |
b8df3223 AD |
652 | } |
653 | else | |
654 | YYFPRINTF (yyout, "nterm %s (", yytname[[yytype]]); | |
655 | ||
656 | switch (yytype) | |
657 | { | |
658 | m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl | |
659 | default: | |
660 | break; | |
661 | } | |
662 | YYFPRINTF (yyout, ")"); | |
663 | } | |
664 | #endif /* YYDEBUG. */ | |
665 | ||
666 | ||
b8df3223 AD |
667 | /*-----------------------------------------------. |
668 | | Release the memory associated to this symbol. | | |
669 | `-----------------------------------------------*/ | |
670 | ||
0245f82d AD |
671 | b4_c_function_def([yydestruct], |
672 | [static void], | |
673 | [[int yytype], [yytype]], | |
674 | [[YYSTYPE yyvalue], [yyvalue]]b4_location_if([, | |
675 | [[YYLTYPE yylocation], [yylocation]]])) | |
b8df3223 AD |
676 | { |
677 | /* Pacify ``unused variable'' warnings. */ | |
678 | (void) yyvalue; | |
679 | b4_location_if([ (void) yylocation; | |
680 | ])dnl | |
681 | ||
682 | switch (yytype) | |
683 | { | |
684 | m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))dnl | |
685 | default: | |
686 | break; | |
687 | } | |
688 | } | |
689 | ||
4a2a22f4 AD |
690 | \f |
691 | ||
0245f82d | 692 | /* Prevent warnings from -Wmissing-prototypes. */ |
4a2a22f4 AD |
693 | |
694 | #ifdef YYPARSE_PARAM | |
695 | # if defined (__STDC__) || defined (__cplusplus) | |
0245f82d | 696 | int yyparse (void *YYPARSE_PARAM); |
4a2a22f4 | 697 | # else |
0245f82d | 698 | int yyparse (); |
4a2a22f4 | 699 | # endif |
0245f82d AD |
700 | #else /* ! YYPARSE_PARAM */ |
701 | b4_c_function_decl([yyparse], [int], b4_parse_param) | |
4a2a22f4 | 702 | #endif |
1b181651 | 703 | |
0245f82d | 704 | |
74310291 AD |
705 | m4_divert_push([KILL])# ======================== M4 code. |
706 | # b4_declare_parser_variables | |
707 | # --------------------------- | |
708 | # Declare the variables that are global, or local to YYPARSE if | |
0245f82d | 709 | # pure-parser. |
74310291 AD |
710 | m4_define([b4_declare_parser_variables], |
711 | [/* The lookahead symbol. */ | |
712 | int yychar; | |
713 | ||
714 | /* The semantic value of the lookahead symbol. */ | |
715 | YYSTYPE yylval; | |
716 | ||
717 | /* Number of parse errors so far. */ | |
718 | int yynerrs;b4_location_if([ | |
719 | /* Location data for the lookahead symbol. */ | |
58612f1d | 720 | YYLTYPE yylloc;]) |
74310291 AD |
721 | ]) |
722 | m4_divert_pop([KILL])dnl# ====================== End of M4 code. | |
58612f1d | 723 | |
74310291 AD |
724 | b4_pure_if([], |
725 | [b4_declare_parser_variables]) | |
a35f64ea | 726 | |
0245f82d AD |
727 | |
728 | /*----------. | |
729 | | yyparse. | | |
730 | `----------*/ | |
731 | ||
732 | #ifdef YYPARSE_PARAM | |
733 | # if defined (__STDC__) || defined (__cplusplus) | |
734 | int yyparse (void *YYPARSE_PARAM) | |
735 | # else | |
736 | int yyparse (YYPARSE_PARAM) | |
737 | void *YYPARSE_PARAM; | |
738 | # endif | |
739 | #else /* ! YYPARSE_PARAM */ | |
740 | b4_c_function_def([yyparse], [int], b4_parse_param) | |
741 | #endif | |
be2a1a68 | 742 | {[ |
74310291 | 743 | ]b4_pure_if([b4_declare_parser_variables])[ |
10fa2066 RS |
744 | register int yystate; |
745 | register int yyn; | |
600f9b0c | 746 | int yyresult; |
b07b484a AD |
747 | /* Number of tokens to shift before error messages enabled. */ |
748 | int yyerrstatus; | |
749 | /* Lookahead token as an internal (translated) token number. */ | |
750 | int yychar1 = 0; | |
10fa2066 | 751 | |
bb10be54 AD |
752 | /* Three stacks and their tools: |
753 | `yyss': related to states, | |
e9e4c321 | 754 | `yyvs': related to semantic values, |
bb10be54 AD |
755 | `yyls': related to locations. |
756 | ||
757 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
758 | to reallocate them elsewhere. */ | |
759 | ||
e8cb70b9 | 760 | /* The state stack. */ |
b07b484a | 761 | short yyssa[YYINITDEPTH]; |
bb10be54 AD |
762 | short *yyss = yyssa; |
763 | register short *yyssp; | |
764 | ||
b07b484a AD |
765 | /* The semantic value stack. */ |
766 | YYSTYPE yyvsa[YYINITDEPTH]; | |
b07b484a | 767 | YYSTYPE *yyvs = yyvsa; |
bb10be54 | 768 | register YYSTYPE *yyvsp; |
10fa2066 | 769 | |
58612f1d AD |
770 | ]b4_location_if( |
771 | [[ /* The location stack. */ | |
b07b484a | 772 | YYLTYPE yylsa[YYINITDEPTH]; |
10fa2066 | 773 | YYLTYPE *yyls = yylsa; |
58612f1d | 774 | YYLTYPE *yylsp;]])[ |
10fa2066 | 775 | |
58612f1d | 776 | #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[) |
10fa2066 | 777 | |
7093d0f5 | 778 | YYSIZE_T yystacksize = YYINITDEPTH; |
10fa2066 | 779 | |
6666f98f AD |
780 | /* The variables used to return semantic value and location from the |
781 | action routines. */ | |
bb10be54 | 782 | YYSTYPE yyval; |
58612f1d | 783 | ]b4_location_if([ YYLTYPE yyloc;])[ |
10fa2066 | 784 | |
6666f98f | 785 | /* When reducing, the number of symbols on the RHS of the reduced |
e8cb70b9 | 786 | rule. */ |
10fa2066 RS |
787 | int yylen; |
788 | ||
7ea5e977 | 789 | YYDPRINTF ((stderr, "Starting parse\n")); |
10fa2066 RS |
790 | |
791 | yystate = 0; | |
792 | yyerrstatus = 0; | |
17da6427 PB |
793 | yynerrs = 0; |
794 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
10fa2066 RS |
795 | |
796 | /* Initialize stack pointers. | |
797 | Waste one element of value and location stack | |
798 | so that they stay on the same level as the state stack. | |
799 | The wasted elements are never initialized. */ | |
800 | ||
cbd89906 | 801 | yyssp = yyss; |
10fa2066 | 802 | yyvsp = yyvs; |
58612f1d | 803 | ]b4_location_if([ yylsp = yyls;])[ |
cbd89906 | 804 | goto yysetstate; |
10fa2066 | 805 | |
71da9eea AD |
806 | /*------------------------------------------------------------. |
807 | | yynewstate -- Push a new state, which is found in yystate. | | |
808 | `------------------------------------------------------------*/ | |
342b8b6e | 809 | yynewstate: |
71da9eea AD |
810 | /* In all cases, when you get here, the value and location stacks |
811 | have just been pushed. so pushing a state here evens the stacks. | |
812 | */ | |
cbd89906 PE |
813 | yyssp++; |
814 | ||
342b8b6e | 815 | yysetstate: |
cbd89906 | 816 | *yyssp = yystate; |
10fa2066 | 817 | |
39912f52 | 818 | if (yyss + yystacksize - 1 <= yyssp) |
10fa2066 | 819 | { |
10fa2066 | 820 | /* Get the current used size of the three stacks, in elements. */ |
7093d0f5 | 821 | YYSIZE_T yysize = yyssp - yyss + 1; |
10fa2066 RS |
822 | |
823 | #ifdef yyoverflow | |
3d76b07d AD |
824 | { |
825 | /* Give user a chance to reallocate the stack. Use copies of | |
826 | these so that the &'s don't force the real ones into | |
827 | memory. */ | |
828 | YYSTYPE *yyvs1 = yyvs; | |
829 | short *yyss1 = yyss; | |
58612f1d | 830 | ]b4_location_if([ YYLTYPE *yyls1 = yyls;])[ |
3d76b07d AD |
831 | |
832 | /* Each stack pointer address is followed by the size of the | |
58612f1d AD |
833 | data in use in that stack, in bytes. This used to be a |
834 | conditional around just the two extra args, but that might | |
835 | be undefined if yyoverflow is a macro. */ | |
3d76b07d | 836 | yyoverflow ("parser stack overflow", |
7093d0f5 AD |
837 | &yyss1, yysize * sizeof (*yyssp), |
838 | &yyvs1, yysize * sizeof (*yyvsp), | |
58612f1d | 839 | ]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[ |
3d76b07d | 840 | &yystacksize); |
58612f1d | 841 | ]b4_location_if([ yyls = yyls1;])[ |
3d76b07d AD |
842 | yyss = yyss1; |
843 | yyvs = yyvs1; | |
844 | } | |
10fa2066 | 845 | #else /* no yyoverflow */ |
cf44a9ae PE |
846 | # ifndef YYSTACK_RELOCATE |
847 | goto yyoverflowlab; | |
848 | # else | |
10fa2066 | 849 | /* Extend the stack our own way. */ |
39912f52 | 850 | if (YYMAXDEPTH <= yystacksize) |
600f9b0c | 851 | goto yyoverflowlab; |
10fa2066 | 852 | yystacksize *= 2; |
39912f52 | 853 | if (YYMAXDEPTH < yystacksize) |
10fa2066 | 854 | yystacksize = YYMAXDEPTH; |
e9e4c321 | 855 | |
600f9b0c PE |
856 | { |
857 | short *yyss1 = yyss; | |
2729e106 PE |
858 | union yyalloc *yyptr = |
859 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | |
600f9b0c PE |
860 | if (! yyptr) |
861 | goto yyoverflowlab; | |
5b041382 PE |
862 | YYSTACK_RELOCATE (yyss); |
863 | YYSTACK_RELOCATE (yyvs); | |
58612f1d | 864 | ]b4_location_if([ YYSTACK_RELOCATE (yyls);])[ |
cf44a9ae | 865 | # undef YYSTACK_RELOCATE |
600f9b0c PE |
866 | if (yyss1 != yyssa) |
867 | YYSTACK_FREE (yyss1); | |
868 | } | |
cf44a9ae | 869 | # endif |
10fa2066 RS |
870 | #endif /* no yyoverflow */ |
871 | ||
7093d0f5 AD |
872 | yyssp = yyss + yysize - 1; |
873 | yyvsp = yyvs + yysize - 1; | |
58612f1d | 874 | ]b4_location_if([ yylsp = yyls + yysize - 1;])[ |
10fa2066 | 875 | |
7ea5e977 | 876 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
600f9b0c | 877 | (unsigned long int) yystacksize)); |
10fa2066 | 878 | |
39912f52 | 879 | if (yyss + yystacksize - 1 <= yyssp) |
10fa2066 RS |
880 | YYABORT; |
881 | } | |
882 | ||
7ea5e977 | 883 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
10fa2066 RS |
884 | |
885 | goto yybackup; | |
71da9eea | 886 | |
71da9eea AD |
887 | /*-----------. |
888 | | yybackup. | | |
889 | `-----------*/ | |
890 | yybackup: | |
10fa2066 RS |
891 | |
892 | /* Do appropriate processing given the current state. */ | |
893 | /* Read a lookahead token if we need one and don't already have one. */ | |
894 | /* yyresume: */ | |
895 | ||
896 | /* First try to decide what to do without reference to lookahead token. */ | |
897 | ||
898 | yyn = yypact[yystate]; | |
12b0043a | 899 | if (yyn == YYPACT_NINF) |
10fa2066 RS |
900 | goto yydefault; |
901 | ||
902 | /* Not known => get a lookahead token if don't already have one. */ | |
903 | ||
904 | /* yychar is either YYEMPTY or YYEOF | |
905 | or a valid token in external form. */ | |
906 | ||
17da6427 | 907 | if (yychar == YYEMPTY) |
10fa2066 | 908 | { |
7ea5e977 | 909 | YYDPRINTF ((stderr, "Reading a token: ")); |
17da6427 | 910 | yychar = YYLEX; |
10fa2066 RS |
911 | } |
912 | ||
e8cb70b9 | 913 | /* Convert token to internal form (in yychar1) for indexing tables with. */ |
10fa2066 | 914 | |
17da6427 | 915 | if (yychar <= 0) /* This means end of input. */ |
10fa2066 RS |
916 | { |
917 | yychar1 = 0; | |
17da6427 | 918 | yychar = YYEOF; /* Don't call YYLEX any more. */ |
10fa2066 | 919 | |
7ea5e977 | 920 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
10fa2066 RS |
921 | } |
922 | else | |
923 | { | |
17da6427 | 924 | yychar1 = YYTRANSLATE (yychar); |
10fa2066 | 925 | |
253862fd AD |
926 | /* We have to keep this `#if YYDEBUG', since we use variables |
927 | which are defined only if `YYDEBUG' is set. */ | |
928 | YYDPRINTF ((stderr, "Next token is ")); | |
929 | YYDSYMPRINT ((stderr, yychar1, yylval]b4_location_if([, yyloc])[)); | |
930 | YYDPRINTF ((stderr, "\n")); | |
10fa2066 RS |
931 | } |
932 | ||
e5cfd9d8 PE |
933 | /* If the proper action on seeing token YYCHAR1 is to reduce or to |
934 | detect an error, take that action. */ | |
10fa2066 | 935 | yyn += yychar1; |
12b0043a | 936 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1) |
e5cfd9d8 PE |
937 | goto yydefault; |
938 | yyn = yytable[yyn]; | |
939 | if (yyn <= 0) | |
10fa2066 | 940 | { |
e5cfd9d8 PE |
941 | if (yyn == 0 || yyn == YYTABLE_NINF) |
942 | goto yyerrlab; | |
10fa2066 RS |
943 | yyn = -yyn; |
944 | goto yyreduce; | |
945 | } | |
10fa2066 RS |
946 | |
947 | if (yyn == YYFINAL) | |
948 | YYACCEPT; | |
949 | ||
950 | /* Shift the lookahead token. */ | |
7ea5e977 | 951 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", |
b7575ffe | 952 | yychar, yytname[yychar1])); |
10fa2066 RS |
953 | |
954 | /* Discard the token being shifted unless it is eof. */ | |
17da6427 PB |
955 | if (yychar != YYEOF) |
956 | yychar = YYEMPTY; | |
10fa2066 | 957 | |
17da6427 | 958 | *++yyvsp = yylval; |
58612f1d | 959 | ]b4_location_if([ *++yylsp = yylloc;])[ |
10fa2066 | 960 | |
71da9eea AD |
961 | /* Count tokens shifted since error; after three, turn off error |
962 | status. */ | |
963 | if (yyerrstatus) | |
964 | yyerrstatus--; | |
10fa2066 RS |
965 | |
966 | yystate = yyn; | |
967 | goto yynewstate; | |
968 | ||
10fa2066 | 969 | |
71da9eea AD |
970 | /*-----------------------------------------------------------. |
971 | | yydefault -- do the default action for the current state. | | |
972 | `-----------------------------------------------------------*/ | |
973 | yydefault: | |
10fa2066 RS |
974 | yyn = yydefact[yystate]; |
975 | if (yyn == 0) | |
976 | goto yyerrlab; | |
71da9eea | 977 | goto yyreduce; |
10fa2066 | 978 | |
71da9eea AD |
979 | |
980 | /*-----------------------------. | |
981 | | yyreduce -- Do a reduction. | | |
982 | `-----------------------------*/ | |
10fa2066 | 983 | yyreduce: |
71da9eea | 984 | /* yyn is the number of a rule to reduce with. */ |
10fa2066 | 985 | yylen = yyr2[yyn]; |
da9abf43 AD |
986 | |
987 | /* If YYLEN is nonzero, implement the default value of the action: | |
573c1d9f | 988 | `$$ = $1'. |
da9abf43 | 989 | |
accea6db PE |
990 | Otherwise, the following line sets YYVAL to garbage. |
991 | This behavior is undocumented and Bison | |
da9abf43 AD |
992 | users should not rely upon it. Assigning to YYVAL |
993 | unconditionally makes the parser a bit smaller, and it avoids a | |
994 | GCC warning that YYVAL may be used uninitialized. */ | |
995 | yyval = yyvsp[1-yylen]; | |
3abcd459 | 996 | |
58612f1d AD |
997 | ]b4_location_if( |
998 | [ /* Default location. */ | |
999 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);])[ | |
10fa2066 | 1000 | |
0de741ca AD |
1001 | #if YYDEBUG |
1002 | /* We have to keep this `#if YYDEBUG', since we use variables which | |
1003 | are defined only if `YYDEBUG' is set. */ | |
17da6427 | 1004 | if (yydebug) |
10fa2066 | 1005 | { |
7093d0f5 | 1006 | int yyi; |
10fa2066 | 1007 | |
7ea5e977 | 1008 | YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", |
3db472b9 | 1009 | yyn - 1, yyrline[yyn]); |
10fa2066 RS |
1010 | |
1011 | /* Print the symbols being reduced, and their result. */ | |
39912f52 | 1012 | for (yyi = yyprhs[yyn]; 0 <= yyrhs[yyi]; yyi++) |
7ea5e977 AD |
1013 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
1014 | YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
10fa2066 RS |
1015 | } |
1016 | #endif | |
a8289c62 | 1017 | switch (yyn) |
be2a1a68 AD |
1018 | ]{ |
1019 | b4_actions | |
a8289c62 | 1020 | } |
897668ee | 1021 | |
be2a1a68 | 1022 | /* Line __line__ of __file__. */ |
06446ccf | 1023 | #line __oline__ "__ofile__" |
10fa2066 | 1024 | \f |
be2a1a68 | 1025 | [ yyvsp -= yylen; |
10fa2066 | 1026 | yyssp -= yylen; |
58612f1d | 1027 | ]b4_location_if([ yylsp -= yylen;])[ |
10fa2066 | 1028 | |
5a35a6cb | 1029 | #if YYDEBUG |
17da6427 | 1030 | if (yydebug) |
10fa2066 | 1031 | { |
7093d0f5 | 1032 | short *yyssp1 = yyss - 1; |
7ea5e977 | 1033 | YYFPRINTF (stderr, "state stack now"); |
7093d0f5 | 1034 | while (yyssp1 != yyssp) |
7ea5e977 AD |
1035 | YYFPRINTF (stderr, " %d", *++yyssp1); |
1036 | YYFPRINTF (stderr, "\n"); | |
10fa2066 | 1037 | } |
5a35a6cb | 1038 | #endif |
10fa2066 RS |
1039 | |
1040 | *++yyvsp = yyval; | |
58612f1d | 1041 | ]b4_location_if([ *++yylsp = yyloc;])[ |
10fa2066 | 1042 | |
41aca2e0 AD |
1043 | /* Now `shift' the result of the reduction. Determine what state |
1044 | that goes to, based on the state we popped back to and the rule | |
1045 | number reduced by. */ | |
10fa2066 RS |
1046 | |
1047 | yyn = yyr1[yyn]; | |
1048 | ||
7742ddeb | 1049 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
12b0043a | 1050 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
10fa2066 RS |
1051 | yystate = yytable[yystate]; |
1052 | else | |
7742ddeb | 1053 | yystate = yydefgoto[yyn - YYNTOKENS]; |
10fa2066 RS |
1054 | |
1055 | goto yynewstate; | |
1056 | ||
10fa2066 | 1057 | |
71da9eea AD |
1058 | /*------------------------------------. |
1059 | | yyerrlab -- here on detecting error | | |
1060 | `------------------------------------*/ | |
1061 | yyerrlab: | |
1062 | /* If not already recovering from an error, report this error. */ | |
1063 | if (!yyerrstatus) | |
10fa2066 | 1064 | { |
17da6427 | 1065 | ++yynerrs; |
df5aed8c PE |
1066 | #if YYERROR_VERBOSE |
1067 | yyn = yypact[yystate]; | |
1068 | ||
1069 | if (YYPACT_NINF < yyn && yyn < YYLAST) | |
1070 | { | |
1071 | YYSIZE_T yysize = 0; | |
1072 | int yytype = YYTRANSLATE (yychar); | |
1073 | char *yymsg; | |
1074 | int yyx, yycount; | |
1075 | ||
1076 | yycount = 0; | |
1077 | /* Start YYX at -YYN if negative to avoid negative indexes in | |
1078 | YYCHECK. */ | |
1079 | for (yyx = yyn < 0 ? -yyn : 0; | |
1080 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) | |
1081 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | |
1082 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; | |
1083 | yysize += yystrlen ("parse error, unexpected ") + 1; | |
1084 | yysize += yystrlen (yytname[yytype]); | |
1085 | yymsg = (char *) YYSTACK_ALLOC (yysize); | |
1086 | if (yymsg != 0) | |
1087 | { | |
1088 | char *yyp = yystpcpy (yymsg, "parse error, unexpected "); | |
1089 | yyp = yystpcpy (yyp, yytname[yytype]); | |
1090 | ||
1091 | if (yycount < 5) | |
1092 | { | |
1093 | yycount = 0; | |
1094 | for (yyx = yyn < 0 ? -yyn : 0; | |
1095 | yyx < (int) (sizeof (yytname) / sizeof (char *)); | |
1096 | yyx++) | |
1097 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | |
1098 | { | |
1099 | const char *yyq = ! yycount ? ", expecting " : " or "; | |
1100 | yyp = yystpcpy (yyp, yyq); | |
1101 | yyp = yystpcpy (yyp, yytname[yyx]); | |
1102 | yycount++; | |
1103 | } | |
1104 | } | |
1105 | yyerror (yymsg); | |
1106 | YYSTACK_FREE (yymsg); | |
1107 | } | |
1108 | else | |
1109 | yyerror ("parse error; also virtual memory exhausted"); | |
1110 | } | |
1111 | else | |
1112 | #endif /* YYERROR_VERBOSE */ | |
1113 | yyerror ("parse error"); | |
10fa2066 | 1114 | } |
10fa2066 | 1115 | goto yyerrlab1; |
10fa2066 | 1116 | |
71da9eea | 1117 | |
e8cb70b9 PB |
1118 | /*----------------------------------------------------. |
1119 | | yyerrlab1 -- error raised explicitly by an action. | | |
1120 | `----------------------------------------------------*/ | |
71da9eea | 1121 | yyerrlab1: |
10fa2066 RS |
1122 | if (yyerrstatus == 3) |
1123 | { | |
71da9eea AD |
1124 | /* If just tried and failed to reuse lookahead token after an |
1125 | error, discard it. */ | |
10fa2066 | 1126 | |
e8cb70b9 | 1127 | /* Return failure if at end of input. */ |
17da6427 | 1128 | if (yychar == YYEOF) |
5719c109 AD |
1129 | { |
1130 | /* Pop the error token. */ | |
1131 | YYPOPSTACK; | |
1132 | /* Pop the rest of the stack. */ | |
39912f52 | 1133 | while (yyss < yyssp) |
5719c109 | 1134 | { |
253862fd AD |
1135 | YYDPRINTF ((stderr, "Error: popping ")); |
1136 | YYDSYMPRINT ((stderr, | |
1137 | yystos[*yyssp], | |
1138 | *yyvsp]b4_location_if([, *yylsp])[)); | |
1139 | YYDPRINTF ((stderr, "\n")); | |
87542d29 | 1140 | yydestruct (yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[); |
5719c109 AD |
1141 | YYPOPSTACK; |
1142 | } | |
1143 | YYABORT; | |
1144 | } | |
1145 | ||
7ea5e977 | 1146 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", |
17da6427 | 1147 | yychar, yytname[yychar1])); |
87542d29 | 1148 | yydestruct (yychar1, yylval]b4_location_if([, yylloc])[); |
17da6427 | 1149 | yychar = YYEMPTY; |
10fa2066 RS |
1150 | } |
1151 | ||
71da9eea AD |
1152 | /* Else will try to reuse lookahead token after shifting the error |
1153 | token. */ | |
10fa2066 | 1154 | |
cf44a9ae | 1155 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
10fa2066 | 1156 | |
660bc8dd PE |
1157 | for (;;) |
1158 | { | |
1159 | yyn = yypact[yystate]; | |
12b0043a | 1160 | if (yyn != YYPACT_NINF) |
660bc8dd PE |
1161 | { |
1162 | yyn += YYTERROR; | |
1163 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | |
1164 | { | |
1165 | yyn = yytable[yyn]; | |
1166 | if (0 < yyn) | |
1167 | break; | |
1168 | } | |
1169 | } | |
10fa2066 | 1170 | |
660bc8dd PE |
1171 | /* Pop the current state because it cannot handle the error token. */ |
1172 | if (yyssp == yyss) | |
1173 | YYABORT; | |
5504898e | 1174 | |
253862fd AD |
1175 | YYDPRINTF ((stderr, "Error: popping ")); |
1176 | YYDSYMPRINT ((stderr, | |
1177 | yystos[*yyssp], *yyvsp]b4_location_if([, *yylsp])[)); | |
1178 | YYDPRINTF ((stderr, "\n")); | |
5504898e | 1179 | |
87542d29 | 1180 | yydestruct (yystos[yystate], *yyvsp]b4_location_if([, *yylsp])[); |
660bc8dd PE |
1181 | yyvsp--; |
1182 | yystate = *--yyssp; | |
58612f1d | 1183 | ]b4_location_if([ yylsp--;])[ |
10fa2066 | 1184 | |
5a35a6cb | 1185 | #if YYDEBUG |
660bc8dd PE |
1186 | if (yydebug) |
1187 | { | |
1188 | short *yyssp1 = yyss - 1; | |
1189 | YYFPRINTF (stderr, "Error: state stack now"); | |
1190 | while (yyssp1 != yyssp) | |
1191 | YYFPRINTF (stderr, " %d", *++yyssp1); | |
1192 | YYFPRINTF (stderr, "\n"); | |
1193 | } | |
5a35a6cb | 1194 | #endif |
10fa2066 | 1195 | } |
10fa2066 RS |
1196 | |
1197 | if (yyn == YYFINAL) | |
1198 | YYACCEPT; | |
1199 | ||
7ea5e977 | 1200 | YYDPRINTF ((stderr, "Shifting error token, ")); |
10fa2066 | 1201 | |
17da6427 | 1202 | *++yyvsp = yylval; |
58612f1d | 1203 | ]b4_location_if([ *++yylsp = yylloc;])[ |
10fa2066 RS |
1204 | |
1205 | yystate = yyn; | |
1206 | goto yynewstate; | |
70ddf897 | 1207 | |
71da9eea AD |
1208 | |
1209 | /*-------------------------------------. | |
1210 | | yyacceptlab -- YYACCEPT comes here. | | |
1211 | `-------------------------------------*/ | |
1212 | yyacceptlab: | |
600f9b0c PE |
1213 | yyresult = 0; |
1214 | goto yyreturn; | |
71da9eea AD |
1215 | |
1216 | /*-----------------------------------. | |
1217 | | yyabortlab -- YYABORT comes here. | | |
1218 | `-----------------------------------*/ | |
1219 | yyabortlab: | |
600f9b0c PE |
1220 | yyresult = 1; |
1221 | goto yyreturn; | |
1222 | ||
0bfb02ff | 1223 | #ifndef yyoverflow |
ca98bf57 AD |
1224 | /*----------------------------------------------. |
1225 | | yyoverflowlab -- parser overflow comes here. | | |
1226 | `----------------------------------------------*/ | |
600f9b0c PE |
1227 | yyoverflowlab: |
1228 | yyerror ("parser stack overflow"); | |
1229 | yyresult = 2; | |
1230 | /* Fall through. */ | |
0bfb02ff | 1231 | #endif |
600f9b0c PE |
1232 | |
1233 | yyreturn: | |
1234 | #ifndef yyoverflow | |
1235 | if (yyss != yyssa) | |
1236 | YYSTACK_FREE (yyss); | |
70ddf897 | 1237 | #endif |
600f9b0c | 1238 | return yyresult; |
be2a1a68 AD |
1239 | ]} |
1240 | ||
24c0aad7 | 1241 | |
be2a1a68 AD |
1242 | b4_epilogue |
1243 | m4_if(b4_defines_flag, 0, [], | |
c76e14da AD |
1244 | [#output "b4_output_header_name" |
1245 | b4_copyright([Skeleton parser for Yacc-like parsing with Bison], | |
0252b55c PE |
1246 | [1984, 1989, 1990, 2000, 2001, 2002]) |
1247 | ||
1248 | /* As a special exception, when this file is copied by Bison into a | |
1249 | Bison output file, you may use that output file without restriction. | |
1250 | This special exception was added by the Free Software Foundation | |
1251 | in version 1.24 of Bison. */ | |
c76e14da | 1252 | |
be2a1a68 AD |
1253 | #ifndef b4_header_guard |
1254 | # define b4_header_guard | |
1255 | ||
0d8bed56 | 1256 | b4_token_defines(b4_tokens) |
be2a1a68 AD |
1257 | |
1258 | #ifndef YYSTYPE | |
e9955c83 | 1259 | m4_ifdef([b4_stype], |
642cb8f8 | 1260 | [#line b4_stype_line "b4_filename" |
e96c9728 AD |
1261 | typedef union b4_stype yystype; |
1262 | /* Line __line__ of __file__. */ | |
1263 | #line __oline__ "__ofile__"], | |
e9955c83 | 1264 | [typedef int yystype;]) |
be2a1a68 AD |
1265 | # define YYSTYPE yystype |
1266 | #endif | |
1267 | ||
74310291 | 1268 | b4_pure_if([], |
be2a1a68 AD |
1269 | [extern YYSTYPE b4_prefix[]lval;]) |
1270 | ||
58612f1d | 1271 | b4_location_if( |
be2a1a68 AD |
1272 | [#ifndef YYLTYPE |
1273 | typedef struct yyltype | |
1274 | { | |
1275 | int first_line; | |
1276 | int first_column; | |
1277 | int last_line; | |
1278 | int last_column; | |
1279 | } yyltype; | |
1280 | # define YYLTYPE yyltype | |
1281 | #endif | |
ff48177d | 1282 | |
be2a1a68 AD |
1283 | m4_if(b4_pure, [0], |
1284 | [extern YYLTYPE b4_prefix[]lloc;]) | |
1285 | ]) | |
1286 | #endif /* not b4_header_guard */ | |
1287 | ]) |