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