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