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