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