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