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