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