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