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