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