]>
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 | ||
5372019f | 337 | typedef b4_uint_type(b4_translate_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. */ |
5df5f6d5 | 350 | static const b4_uint_type(b4_prhs_max) yyprhs[[]] = |
a8289c62 | 351 | { |
be2a1a68 | 352 | b4_prhs |
a8289c62 RA |
353 | }; |
354 | ||
3db472b9 | 355 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
5df5f6d5 | 356 | static const b4_sint_type(b4_rhs_max) yyrhs[[]] = |
a8289c62 | 357 | { |
be2a1a68 | 358 | b4_rhs |
a8289c62 RA |
359 | }; |
360 | ||
be2a1a68 | 361 | /* YYRLINE[[YYN]] -- source line where rule number YYN was defined. */ |
5df5f6d5 | 362 | static const b4_uint_type(b4_rline_max) yyrline[[]] = |
a8289c62 | 363 | { |
be2a1a68 | 364 | b4_rline |
a8289c62 RA |
365 | }; |
366 | #endif | |
367 | ||
c527b2d4 | 368 | #if (YYDEBUG) || YYERROR_VERBOSE |
be2a1a68 | 369 | /* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM. |
7742ddeb | 370 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
be2a1a68 | 371 | static const char *const yytname[[]] = |
a8289c62 | 372 | { |
be2a1a68 | 373 | b4_tname |
a8289c62 RA |
374 | }; |
375 | #endif | |
376 | ||
be2a1a68 AD |
377 | /* YYTOKNUM[[YYN]] -- Index in YYTNAME corresponding to YYLEX. */ |
378 | static const short yytoknum[[]] = | |
a8289c62 | 379 | { |
be2a1a68 | 380 | b4_toknum |
a8289c62 RA |
381 | }; |
382 | ||
be2a1a68 | 383 | /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */ |
9515e8a7 | 384 | static const yy_token_number_type yyr1[[]] = |
a8289c62 | 385 | { |
be2a1a68 | 386 | b4_r1 |
a8289c62 RA |
387 | }; |
388 | ||
be2a1a68 | 389 | /* YYR2[[YYN]] -- Number of symbols composing right hand side of rule YYN. */ |
5df5f6d5 | 390 | static const b4_uint_type(b4_r2_max) yyr2[[]] = |
a8289c62 | 391 | { |
be2a1a68 | 392 | b4_r2 |
a8289c62 RA |
393 | }; |
394 | ||
be2a1a68 | 395 | /* YYDEFACT[[S]] -- default rule to reduce with in state S when YYTABLE |
a8289c62 RA |
396 | doesn't specify something else to do. Zero means the default is an |
397 | error. */ | |
be2a1a68 | 398 | static const short yydefact[[]] = |
a8289c62 | 399 | { |
be2a1a68 | 400 | b4_defact |
a8289c62 RA |
401 | }; |
402 | ||
be2a1a68 AD |
403 | /* YYPGOTO[[NTERM-NUM]]. */ |
404 | static const short yydefgoto[[]] = | |
a8289c62 | 405 | { |
be2a1a68 | 406 | b4_defgoto |
a8289c62 RA |
407 | }; |
408 | ||
be2a1a68 | 409 | /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing |
7742ddeb | 410 | STATE-NUM. */ |
be2a1a68 | 411 | static const short yypact[[]] = |
a8289c62 | 412 | { |
be2a1a68 | 413 | b4_pact |
a8289c62 RA |
414 | }; |
415 | ||
be2a1a68 AD |
416 | /* YYPGOTO[[NTERM-NUM]]. */ |
417 | static const short yypgoto[[]] = | |
a8289c62 | 418 | { |
be2a1a68 | 419 | b4_pgoto |
a8289c62 RA |
420 | }; |
421 | ||
be2a1a68 | 422 | /* YYTABLE[[YYPACT[STATE-NUM]]]. What to do in state STATE-NUM. If |
7742ddeb AD |
423 | positive, shift that token. If negative, reduce the rule which |
424 | number is the opposite. If zero, do what YYDEFACT says. */ | |
be2a1a68 | 425 | static const short yytable[[]] = |
a8289c62 | 426 | { |
be2a1a68 | 427 | b4_table |
a8289c62 RA |
428 | }; |
429 | ||
be2a1a68 | 430 | static const short yycheck[[]] = |
a8289c62 | 431 | { |
be2a1a68 | 432 | b4_check |
a8289c62 RA |
433 | }; |
434 | ||
7093d0f5 AD |
435 | |
436 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | |
437 | # define YYSIZE_T __SIZE_TYPE__ | |
438 | #endif | |
439 | #if ! defined (YYSIZE_T) && defined (size_t) | |
440 | # define YYSIZE_T size_t | |
441 | #endif | |
b7575ffe | 442 | #if ! defined (YYSIZE_T) |
45119af1 PE |
443 | # if defined (__STDC__) || defined (__cplusplus) |
444 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | |
445 | # define YYSIZE_T size_t | |
b7575ffe | 446 | # endif |
7093d0f5 AD |
447 | #endif |
448 | #if ! defined (YYSIZE_T) | |
449 | # define YYSIZE_T unsigned int | |
450 | #endif | |
451 | ||
10fa2066 | 452 | #define yyerrok (yyerrstatus = 0) |
17da6427 | 453 | #define yyclearin (yychar = YYEMPTY) |
10fa2066 RS |
454 | #define YYEMPTY -2 |
455 | #define YYEOF 0 | |
a8289c62 | 456 | |
70ddf897 | 457 | #define YYACCEPT goto yyacceptlab |
a8289c62 | 458 | #define YYABORT goto yyabortlab |
10fa2066 | 459 | #define YYERROR goto yyerrlab1 |
a8289c62 | 460 | |
71da9eea AD |
461 | /* Like YYERROR except do call yyerror. This remains here temporarily |
462 | to ease the transition to the new meaning of YYERROR, for GCC. | |
10fa2066 | 463 | Once GCC version 2 has supplanted version 1, this can go. */ |
a8289c62 | 464 | |
10fa2066 | 465 | #define YYFAIL goto yyerrlab |
a8289c62 | 466 | |
10fa2066 | 467 | #define YYRECOVERING() (!!yyerrstatus) |
a8289c62 | 468 | |
69b4e0c5 | 469 | #define YYBACKUP(Token, Value) \ |
10fa2066 | 470 | do \ |
17da6427 | 471 | if (yychar == YYEMPTY && yylen == 1) \ |
71da9eea | 472 | { \ |
17da6427 | 473 | yychar = (Token); \ |
7742ddeb | 474 | yylval = (Value); \ |
17da6427 | 475 | yychar1 = YYTRANSLATE (yychar); \ |
10fa2066 RS |
476 | YYPOPSTACK; \ |
477 | goto yybackup; \ | |
478 | } \ | |
479 | else \ | |
71da9eea | 480 | { \ |
7742ddeb | 481 | yyerror ("syntax error: cannot back up"); \ |
71da9eea AD |
482 | YYERROR; \ |
483 | } \ | |
10fa2066 RS |
484 | while (0) |
485 | ||
486 | #define YYTERROR 1 | |
487 | #define YYERRCODE 256 | |
488 | ||
3abcd459 | 489 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
b2d52318 | 490 | are run). */ |
3abcd459 AD |
491 | |
492 | #ifndef YYLLOC_DEFAULT | |
b2d52318 AD |
493 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
494 | Current.first_line = Rhs[[1]].first_line; \ | |
495 | Current.first_column = Rhs[[1]].first_column; \ | |
496 | Current.last_line = Rhs[[N]].last_line; \ | |
497 | Current.last_column = Rhs[[N]].last_column; | |
3abcd459 AD |
498 | #endif |
499 | ||
3abcd459 | 500 | /* YYLEX -- calling `yylex' with the right arguments. */ |
553e2b22 AD |
501 | |
502 | #if YYPURE | |
5af1f549 | 503 | # if YYLSP_NEEDED |
b07b484a | 504 | # ifdef YYLEX_PARAM |
17da6427 | 505 | # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) |
b07b484a | 506 | # else |
17da6427 | 507 | # define YYLEX yylex (&yylval, &yylloc) |
b07b484a | 508 | # endif |
71da9eea | 509 | # else /* !YYLSP_NEEDED */ |
b07b484a | 510 | # ifdef YYLEX_PARAM |
17da6427 | 511 | # define YYLEX yylex (&yylval, YYLEX_PARAM) |
b07b484a | 512 | # else |
17da6427 | 513 | # define YYLEX yylex (&yylval) |
b07b484a | 514 | # endif |
71da9eea | 515 | # endif /* !YYLSP_NEEDED */ |
553e2b22 | 516 | #else /* !YYPURE */ |
17da6427 | 517 | # define YYLEX yylex () |
553e2b22 AD |
518 | #endif /* !YYPURE */ |
519 | ||
5a35a6cb | 520 | /* Enable debugging if requested. */ |
0d533154 | 521 | #if YYDEBUG |
b7575ffe PE |
522 | |
523 | # ifndef YYFPRINTF | |
45119af1 PE |
524 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
525 | # define YYFPRINTF fprintf | |
b7575ffe PE |
526 | # endif |
527 | ||
5a35a6cb AD |
528 | # define YYDPRINTF(Args) \ |
529 | do { \ | |
17da6427 | 530 | if (yydebug) \ |
b7575ffe | 531 | YYFPRINTF Args; \ |
5a35a6cb | 532 | } while (0) |
cf44a9ae PE |
533 | /* Nonzero means print parse trace. It is left uninitialized so that |
534 | multiple parsers can coexist. */ | |
17da6427 | 535 | int yydebug; |
5a35a6cb AD |
536 | #else /* !YYDEBUG */ |
537 | # define YYDPRINTF(Args) | |
538 | #endif /* !YYDEBUG */ | |
539 | ||
540 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | |
10fa2066 | 541 | #ifndef YYINITDEPTH |
be2a1a68 | 542 | # define YYINITDEPTH b4_initdepth |
10fa2066 RS |
543 | #endif |
544 | ||
5a35a6cb | 545 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
600f9b0c PE |
546 | if the built-in stack extension method is used). |
547 | ||
548 | Do not make this value too large; the results are undefined if | |
549 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) | |
550 | evaluated with infinite-precision integer arithmetic. */ | |
551 | ||
10fa2066 | 552 | #if YYMAXDEPTH == 0 |
b07b484a | 553 | # undef YYMAXDEPTH |
10fa2066 RS |
554 | #endif |
555 | ||
556 | #ifndef YYMAXDEPTH | |
be2a1a68 | 557 | # define YYMAXDEPTH b4_maxdepth |
10fa2066 | 558 | #endif |
a8289c62 | 559 | |
10fa2066 | 560 | \f |
a8289c62 | 561 | |
7093d0f5 AD |
562 | #if YYERROR_VERBOSE |
563 | ||
564 | # ifndef yystrlen | |
565 | # if defined (__GLIBC__) && defined (_STRING_H) | |
566 | # define yystrlen strlen | |
567 | # else | |
568 | /* Return the length of YYSTR. */ | |
569 | static YYSIZE_T | |
570 | # if defined (__STDC__) || defined (__cplusplus) | |
571 | yystrlen (const char *yystr) | |
572 | # else | |
573 | yystrlen (yystr) | |
574 | const char *yystr; | |
575 | # endif | |
576 | { | |
577 | register const char *yys = yystr; | |
578 | ||
579 | while (*yys++ != '\0') | |
580 | continue; | |
581 | ||
582 | return yys - yystr - 1; | |
583 | } | |
584 | # endif | |
585 | # endif | |
586 | ||
587 | # ifndef yystpcpy | |
588 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | |
589 | # define yystpcpy stpcpy | |
590 | # else | |
591 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | |
592 | YYDEST. */ | |
593 | static char * | |
f11966ff PE |
594 | # if defined (__STDC__) || defined (__cplusplus) |
595 | yystpcpy (char *yydest, const char *yysrc) | |
596 | # else | |
7093d0f5 AD |
597 | yystpcpy (yydest, yysrc) |
598 | char *yydest; | |
599 | const char *yysrc; | |
7093d0f5 AD |
600 | # endif |
601 | { | |
602 | register char *yyd = yydest; | |
603 | register const char *yys = yysrc; | |
604 | ||
605 | while ((*yyd++ = *yys++) != '\0') | |
606 | continue; | |
607 | ||
608 | return yyd - 1; | |
609 | } | |
610 | # endif | |
611 | # endif | |
612 | ||
613 | #endif /* !YYERROR_VERBOSE */ | |
614 | ||
10fa2066 | 615 | \f |
a8289c62 | 616 | |
b658bf92 RS |
617 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed |
618 | into yyparse. The argument should have type void *. | |
619 | It should actually point to an object. | |
620 | Grammar actions can access the variable by casting it | |
621 | to the proper pointer type. */ | |
622 | ||
623 | #ifdef YYPARSE_PARAM | |
45119af1 | 624 | # if defined (__STDC__) || defined (__cplusplus) |
b07b484a AD |
625 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
626 | # define YYPARSE_PARAM_DECL | |
45119af1 | 627 | # else |
b07b484a AD |
628 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM |
629 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
45119af1 | 630 | # endif |
71da9eea | 631 | #else /* !YYPARSE_PARAM */ |
b07b484a AD |
632 | # define YYPARSE_PARAM_ARG |
633 | # define YYPARSE_PARAM_DECL | |
71da9eea | 634 | #endif /* !YYPARSE_PARAM */ |
b658bf92 | 635 | |
1b181651 PE |
636 | /* Prevent warning if -Wstrict-prototypes. */ |
637 | #ifdef __GNUC__ | |
b07b484a | 638 | # ifdef YYPARSE_PARAM |
17da6427 | 639 | int yyparse (void *); |
b07b484a | 640 | # else |
17da6427 | 641 | int yyparse (void); |
b07b484a | 642 | # endif |
1b181651 PE |
643 | #endif |
644 | ||
a35f64ea AD |
645 | /* YY_DECL_VARIABLES -- depending whether we use a pure parser, |
646 | variables are global, or local to YYPARSE. */ | |
647 | ||
7093d0f5 | 648 | #define YY_DECL_NON_LSP_VARIABLES \ |
a35f64ea | 649 | /* The lookahead symbol. */ \ |
17da6427 | 650 | int yychar; \ |
a35f64ea | 651 | \ |
e8cb70b9 | 652 | /* The semantic value of the lookahead symbol. */ \ |
17da6427 | 653 | YYSTYPE yylval; \ |
a35f64ea AD |
654 | \ |
655 | /* Number of parse errors so far. */ \ | |
17da6427 | 656 | int yynerrs; |
a35f64ea AD |
657 | |
658 | #if YYLSP_NEEDED | |
659 | # define YY_DECL_VARIABLES \ | |
7093d0f5 | 660 | YY_DECL_NON_LSP_VARIABLES \ |
a35f64ea AD |
661 | \ |
662 | /* Location data for the lookahead symbol. */ \ | |
663 | YYLTYPE yylloc; | |
664 | #else | |
665 | # define YY_DECL_VARIABLES \ | |
7093d0f5 | 666 | YY_DECL_NON_LSP_VARIABLES |
a35f64ea AD |
667 | #endif |
668 | ||
e8cb70b9 | 669 | /* If nonreentrant, generate the variables here. */ |
a35f64ea AD |
670 | |
671 | #if !YYPURE | |
672 | YY_DECL_VARIABLES | |
673 | #endif /* !YYPURE */ | |
674 | ||
10fa2066 | 675 | int |
17da6427 | 676 | yyparse (YYPARSE_PARAM_ARG) |
b658bf92 | 677 | YYPARSE_PARAM_DECL |
be2a1a68 | 678 | {[ |
e8cb70b9 | 679 | /* If reentrant, generate the variables here. */ |
a35f64ea AD |
680 | #if YYPURE |
681 | YY_DECL_VARIABLES | |
682 | #endif /* !YYPURE */ | |
683 | ||
10fa2066 RS |
684 | register int yystate; |
685 | register int yyn; | |
600f9b0c | 686 | int yyresult; |
b07b484a AD |
687 | /* Number of tokens to shift before error messages enabled. */ |
688 | int yyerrstatus; | |
689 | /* Lookahead token as an internal (translated) token number. */ | |
690 | int yychar1 = 0; | |
10fa2066 | 691 | |
bb10be54 AD |
692 | /* Three stacks and their tools: |
693 | `yyss': related to states, | |
e9e4c321 | 694 | `yyvs': related to semantic values, |
bb10be54 AD |
695 | `yyls': related to locations. |
696 | ||
697 | Refer to the stacks thru separate pointers, to allow yyoverflow | |
698 | to reallocate them elsewhere. */ | |
699 | ||
e8cb70b9 | 700 | /* The state stack. */ |
b07b484a | 701 | short yyssa[YYINITDEPTH]; |
bb10be54 AD |
702 | short *yyss = yyssa; |
703 | register short *yyssp; | |
704 | ||
b07b484a AD |
705 | /* The semantic value stack. */ |
706 | YYSTYPE yyvsa[YYINITDEPTH]; | |
b07b484a | 707 | YYSTYPE *yyvs = yyvsa; |
bb10be54 | 708 | register YYSTYPE *yyvsp; |
10fa2066 | 709 | |
5af1f549 | 710 | #if YYLSP_NEEDED |
b07b484a AD |
711 | /* The location stack. */ |
712 | YYLTYPE yylsa[YYINITDEPTH]; | |
10fa2066 RS |
713 | YYLTYPE *yyls = yylsa; |
714 | YYLTYPE *yylsp; | |
bb10be54 | 715 | #endif |
10fa2066 | 716 | |
5af1f549 | 717 | #if YYLSP_NEEDED |
b07b484a | 718 | # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
10fa2066 | 719 | #else |
b07b484a | 720 | # define YYPOPSTACK (yyvsp--, yyssp--) |
10fa2066 RS |
721 | #endif |
722 | ||
7093d0f5 | 723 | YYSIZE_T yystacksize = YYINITDEPTH; |
10fa2066 | 724 | |
6666f98f AD |
725 | /* The variables used to return semantic value and location from the |
726 | action routines. */ | |
bb10be54 | 727 | YYSTYPE yyval; |
7093d0f5 | 728 | #if YYLSP_NEEDED |
6666f98f | 729 | YYLTYPE yyloc; |
7093d0f5 | 730 | #endif |
10fa2066 | 731 | |
6666f98f | 732 | /* When reducing, the number of symbols on the RHS of the reduced |
e8cb70b9 | 733 | rule. */ |
10fa2066 RS |
734 | int yylen; |
735 | ||
7ea5e977 | 736 | YYDPRINTF ((stderr, "Starting parse\n")); |
10fa2066 RS |
737 | |
738 | yystate = 0; | |
739 | yyerrstatus = 0; | |
17da6427 PB |
740 | yynerrs = 0; |
741 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
10fa2066 RS |
742 | |
743 | /* Initialize stack pointers. | |
744 | Waste one element of value and location stack | |
745 | so that they stay on the same level as the state stack. | |
746 | The wasted elements are never initialized. */ | |
747 | ||
cbd89906 | 748 | yyssp = yyss; |
10fa2066 | 749 | yyvsp = yyvs; |
5af1f549 | 750 | #if YYLSP_NEEDED |
10fa2066 RS |
751 | yylsp = yyls; |
752 | #endif | |
cbd89906 | 753 | goto yysetstate; |
10fa2066 | 754 | |
71da9eea AD |
755 | /*------------------------------------------------------------. |
756 | | yynewstate -- Push a new state, which is found in yystate. | | |
757 | `------------------------------------------------------------*/ | |
342b8b6e | 758 | yynewstate: |
71da9eea AD |
759 | /* In all cases, when you get here, the value and location stacks |
760 | have just been pushed. so pushing a state here evens the stacks. | |
761 | */ | |
cbd89906 PE |
762 | yyssp++; |
763 | ||
342b8b6e | 764 | yysetstate: |
cbd89906 | 765 | *yyssp = yystate; |
10fa2066 RS |
766 | |
767 | if (yyssp >= yyss + yystacksize - 1) | |
768 | { | |
10fa2066 | 769 | /* Get the current used size of the three stacks, in elements. */ |
7093d0f5 | 770 | YYSIZE_T yysize = yyssp - yyss + 1; |
10fa2066 RS |
771 | |
772 | #ifdef yyoverflow | |
3d76b07d AD |
773 | { |
774 | /* Give user a chance to reallocate the stack. Use copies of | |
775 | these so that the &'s don't force the real ones into | |
776 | memory. */ | |
777 | YYSTYPE *yyvs1 = yyvs; | |
778 | short *yyss1 = yyss; | |
779 | ||
780 | /* Each stack pointer address is followed by the size of the | |
781 | data in use in that stack, in bytes. */ | |
5af1f549 | 782 | # if YYLSP_NEEDED |
3d76b07d AD |
783 | YYLTYPE *yyls1 = yyls; |
784 | /* This used to be a conditional around just the two extra args, | |
785 | but that might be undefined if yyoverflow is a macro. */ | |
786 | yyoverflow ("parser stack overflow", | |
7093d0f5 AD |
787 | &yyss1, yysize * sizeof (*yyssp), |
788 | &yyvs1, yysize * sizeof (*yyvsp), | |
789 | &yyls1, yysize * sizeof (*yylsp), | |
3d76b07d AD |
790 | &yystacksize); |
791 | yyls = yyls1; | |
b07b484a | 792 | # else |
3d76b07d | 793 | yyoverflow ("parser stack overflow", |
7093d0f5 AD |
794 | &yyss1, yysize * sizeof (*yyssp), |
795 | &yyvs1, yysize * sizeof (*yyvsp), | |
3d76b07d | 796 | &yystacksize); |
b07b484a | 797 | # endif |
3d76b07d AD |
798 | yyss = yyss1; |
799 | yyvs = yyvs1; | |
800 | } | |
10fa2066 | 801 | #else /* no yyoverflow */ |
cf44a9ae PE |
802 | # ifndef YYSTACK_RELOCATE |
803 | goto yyoverflowlab; | |
804 | # else | |
10fa2066 RS |
805 | /* Extend the stack our own way. */ |
806 | if (yystacksize >= YYMAXDEPTH) | |
600f9b0c | 807 | goto yyoverflowlab; |
10fa2066 RS |
808 | yystacksize *= 2; |
809 | if (yystacksize > YYMAXDEPTH) | |
810 | yystacksize = YYMAXDEPTH; | |
e9e4c321 | 811 | |
600f9b0c PE |
812 | { |
813 | short *yyss1 = yyss; | |
2729e106 PE |
814 | union yyalloc *yyptr = |
815 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | |
600f9b0c PE |
816 | if (! yyptr) |
817 | goto yyoverflowlab; | |
5b041382 PE |
818 | YYSTACK_RELOCATE (yyss); |
819 | YYSTACK_RELOCATE (yyvs); | |
cf44a9ae | 820 | # if YYLSP_NEEDED |
5b041382 | 821 | YYSTACK_RELOCATE (yyls); |
cf44a9ae PE |
822 | # endif |
823 | # undef YYSTACK_RELOCATE | |
600f9b0c PE |
824 | if (yyss1 != yyssa) |
825 | YYSTACK_FREE (yyss1); | |
826 | } | |
cf44a9ae | 827 | # endif |
10fa2066 RS |
828 | #endif /* no yyoverflow */ |
829 | ||
7093d0f5 AD |
830 | yyssp = yyss + yysize - 1; |
831 | yyvsp = yyvs + yysize - 1; | |
5af1f549 | 832 | #if YYLSP_NEEDED |
7093d0f5 | 833 | yylsp = yyls + yysize - 1; |
10fa2066 RS |
834 | #endif |
835 | ||
7ea5e977 | 836 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
600f9b0c | 837 | (unsigned long int) yystacksize)); |
10fa2066 RS |
838 | |
839 | if (yyssp >= yyss + yystacksize - 1) | |
840 | YYABORT; | |
841 | } | |
842 | ||
7ea5e977 | 843 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
10fa2066 RS |
844 | |
845 | goto yybackup; | |
71da9eea | 846 | |
71da9eea AD |
847 | /*-----------. |
848 | | yybackup. | | |
849 | `-----------*/ | |
850 | yybackup: | |
10fa2066 RS |
851 | |
852 | /* Do appropriate processing given the current state. */ | |
853 | /* Read a lookahead token if we need one and don't already have one. */ | |
854 | /* yyresume: */ | |
855 | ||
856 | /* First try to decide what to do without reference to lookahead token. */ | |
857 | ||
858 | yyn = yypact[yystate]; | |
859 | if (yyn == YYFLAG) | |
860 | goto yydefault; | |
861 | ||
862 | /* Not known => get a lookahead token if don't already have one. */ | |
863 | ||
864 | /* yychar is either YYEMPTY or YYEOF | |
865 | or a valid token in external form. */ | |
866 | ||
17da6427 | 867 | if (yychar == YYEMPTY) |
10fa2066 | 868 | { |
7ea5e977 | 869 | YYDPRINTF ((stderr, "Reading a token: ")); |
17da6427 | 870 | yychar = YYLEX; |
10fa2066 RS |
871 | } |
872 | ||
e8cb70b9 | 873 | /* Convert token to internal form (in yychar1) for indexing tables with. */ |
10fa2066 | 874 | |
17da6427 | 875 | if (yychar <= 0) /* This means end of input. */ |
10fa2066 RS |
876 | { |
877 | yychar1 = 0; | |
17da6427 | 878 | yychar = YYEOF; /* Don't call YYLEX any more. */ |
10fa2066 | 879 | |
7ea5e977 | 880 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
10fa2066 RS |
881 | } |
882 | else | |
883 | { | |
17da6427 | 884 | yychar1 = YYTRANSLATE (yychar); |
10fa2066 | 885 | |
0d533154 AD |
886 | #if YYDEBUG |
887 | /* We have to keep this `#if YYDEBUG', since we use variables | |
888 | which are defined only if `YYDEBUG' is set. */ | |
17da6427 | 889 | if (yydebug) |
10fa2066 | 890 | { |
7ea5e977 | 891 | YYFPRINTF (stderr, "Next token is %d (%s", |
b7575ffe | 892 | yychar, yytname[yychar1]); |
0d533154 AD |
893 | /* Give the individual parser a way to print the precise |
894 | meaning of a token, for further debugging info. */ | |
b07b484a | 895 | # ifdef YYPRINT |
7ea5e977 | 896 | YYPRINT (stderr, yychar, yylval); |
b07b484a | 897 | # endif |
7ea5e977 | 898 | YYFPRINTF (stderr, ")\n"); |
10fa2066 | 899 | } |
0d533154 | 900 | #endif |
10fa2066 RS |
901 | } |
902 | ||
903 | yyn += yychar1; | |
904 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
905 | goto yydefault; | |
906 | ||
907 | yyn = yytable[yyn]; | |
908 | ||
909 | /* yyn is what to do for this token type in this state. | |
910 | Negative => reduce, -yyn is rule number. | |
911 | Positive => shift, yyn is new state. | |
912 | New state is final state => don't bother to shift, | |
913 | just return success. | |
914 | 0, or most negative number => error. */ | |
915 | ||
916 | if (yyn < 0) | |
917 | { | |
918 | if (yyn == YYFLAG) | |
919 | goto yyerrlab; | |
920 | yyn = -yyn; | |
921 | goto yyreduce; | |
922 | } | |
923 | else if (yyn == 0) | |
924 | goto yyerrlab; | |
925 | ||
926 | if (yyn == YYFINAL) | |
927 | YYACCEPT; | |
928 | ||
929 | /* Shift the lookahead token. */ | |
7ea5e977 | 930 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", |
b7575ffe | 931 | yychar, yytname[yychar1])); |
10fa2066 RS |
932 | |
933 | /* Discard the token being shifted unless it is eof. */ | |
17da6427 PB |
934 | if (yychar != YYEOF) |
935 | yychar = YYEMPTY; | |
10fa2066 | 936 | |
17da6427 | 937 | *++yyvsp = yylval; |
5af1f549 | 938 | #if YYLSP_NEEDED |
10fa2066 RS |
939 | *++yylsp = yylloc; |
940 | #endif | |
941 | ||
71da9eea AD |
942 | /* Count tokens shifted since error; after three, turn off error |
943 | status. */ | |
944 | if (yyerrstatus) | |
945 | yyerrstatus--; | |
10fa2066 RS |
946 | |
947 | yystate = yyn; | |
948 | goto yynewstate; | |
949 | ||
10fa2066 | 950 | |
71da9eea AD |
951 | /*-----------------------------------------------------------. |
952 | | yydefault -- do the default action for the current state. | | |
953 | `-----------------------------------------------------------*/ | |
954 | yydefault: | |
10fa2066 RS |
955 | yyn = yydefact[yystate]; |
956 | if (yyn == 0) | |
957 | goto yyerrlab; | |
71da9eea | 958 | goto yyreduce; |
10fa2066 | 959 | |
71da9eea AD |
960 | |
961 | /*-----------------------------. | |
962 | | yyreduce -- Do a reduction. | | |
963 | `-----------------------------*/ | |
10fa2066 | 964 | yyreduce: |
71da9eea | 965 | /* yyn is the number of a rule to reduce with. */ |
10fa2066 | 966 | yylen = yyr2[yyn]; |
da9abf43 AD |
967 | |
968 | /* If YYLEN is nonzero, implement the default value of the action: | |
573c1d9f | 969 | `$$ = $1'. |
da9abf43 AD |
970 | |
971 | Otherwise, the following line sets YYVAL to the semantic value of | |
972 | the lookahead token. This behavior is undocumented and Bison | |
973 | users should not rely upon it. Assigning to YYVAL | |
974 | unconditionally makes the parser a bit smaller, and it avoids a | |
975 | GCC warning that YYVAL may be used uninitialized. */ | |
976 | yyval = yyvsp[1-yylen]; | |
3abcd459 | 977 | |
5af1f549 | 978 | #if YYLSP_NEEDED |
b2d52318 | 979 | /* Default location. */ |
ca96bc2d | 980 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); |
6666f98f | 981 | #endif |
10fa2066 | 982 | |
0de741ca AD |
983 | #if YYDEBUG |
984 | /* We have to keep this `#if YYDEBUG', since we use variables which | |
985 | are defined only if `YYDEBUG' is set. */ | |
17da6427 | 986 | if (yydebug) |
10fa2066 | 987 | { |
7093d0f5 | 988 | int yyi; |
10fa2066 | 989 | |
7ea5e977 | 990 | YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", |
3db472b9 | 991 | yyn - 1, yyrline[yyn]); |
10fa2066 RS |
992 | |
993 | /* Print the symbols being reduced, and their result. */ | |
3db472b9 | 994 | for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++) |
7ea5e977 AD |
995 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
996 | YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
10fa2066 RS |
997 | } |
998 | #endif | |
a8289c62 | 999 | switch (yyn) |
be2a1a68 AD |
1000 | ]{ |
1001 | b4_actions | |
a8289c62 | 1002 | } |
897668ee | 1003 | |
be2a1a68 | 1004 | /* Line __line__ of __file__. */ |
06446ccf | 1005 | #line __oline__ "__ofile__" |
10fa2066 | 1006 | \f |
be2a1a68 | 1007 | [ yyvsp -= yylen; |
10fa2066 | 1008 | yyssp -= yylen; |
5af1f549 | 1009 | #if YYLSP_NEEDED |
10fa2066 RS |
1010 | yylsp -= yylen; |
1011 | #endif | |
1012 | ||
5a35a6cb | 1013 | #if YYDEBUG |
17da6427 | 1014 | if (yydebug) |
10fa2066 | 1015 | { |
7093d0f5 | 1016 | short *yyssp1 = yyss - 1; |
7ea5e977 | 1017 | YYFPRINTF (stderr, "state stack now"); |
7093d0f5 | 1018 | while (yyssp1 != yyssp) |
7ea5e977 AD |
1019 | YYFPRINTF (stderr, " %d", *++yyssp1); |
1020 | YYFPRINTF (stderr, "\n"); | |
10fa2066 | 1021 | } |
5a35a6cb | 1022 | #endif |
10fa2066 RS |
1023 | |
1024 | *++yyvsp = yyval; | |
5af1f549 | 1025 | #if YYLSP_NEEDED |
6666f98f | 1026 | *++yylsp = yyloc; |
10fa2066 RS |
1027 | #endif |
1028 | ||
41aca2e0 AD |
1029 | /* Now `shift' the result of the reduction. Determine what state |
1030 | that goes to, based on the state we popped back to and the rule | |
1031 | number reduced by. */ | |
10fa2066 RS |
1032 | |
1033 | yyn = yyr1[yyn]; | |
1034 | ||
7742ddeb | 1035 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
10fa2066 RS |
1036 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
1037 | yystate = yytable[yystate]; | |
1038 | else | |
7742ddeb | 1039 | yystate = yydefgoto[yyn - YYNTOKENS]; |
10fa2066 RS |
1040 | |
1041 | goto yynewstate; | |
1042 | ||
10fa2066 | 1043 | |
71da9eea AD |
1044 | /*------------------------------------. |
1045 | | yyerrlab -- here on detecting error | | |
1046 | `------------------------------------*/ | |
1047 | yyerrlab: | |
1048 | /* If not already recovering from an error, report this error. */ | |
1049 | if (!yyerrstatus) | |
10fa2066 | 1050 | { |
17da6427 | 1051 | ++yynerrs; |
10fa2066 | 1052 | |
8850be4b | 1053 | #if YYERROR_VERBOSE |
10fa2066 RS |
1054 | yyn = yypact[yystate]; |
1055 | ||
1056 | if (yyn > YYFLAG && yyn < YYLAST) | |
1057 | { | |
7093d0f5 AD |
1058 | YYSIZE_T yysize = 0; |
1059 | char *yymsg; | |
1060 | int yyx, yycount; | |
10fa2066 | 1061 | |
7093d0f5 AD |
1062 | yycount = 0; |
1063 | /* Start YYX at -YYN if negative to avoid negative indexes in | |
f0473484 | 1064 | YYCHECK. */ |
7093d0f5 AD |
1065 | for (yyx = yyn < 0 ? -yyn : 0; |
1066 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) | |
1067 | if (yycheck[yyx + yyn] == yyx) | |
1068 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; | |
1069 | yysize += yystrlen ("parse error, unexpected ") + 1; | |
1070 | yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); | |
1071 | yymsg = (char *) YYSTACK_ALLOC (yysize); | |
1072 | if (yymsg != 0) | |
10fa2066 | 1073 | { |
7093d0f5 AD |
1074 | char *yyp = yystpcpy (yymsg, "parse error, unexpected "); |
1075 | yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); | |
10fa2066 | 1076 | |
7093d0f5 | 1077 | if (yycount < 5) |
10fa2066 | 1078 | { |
7093d0f5 AD |
1079 | yycount = 0; |
1080 | for (yyx = yyn < 0 ? -yyn : 0; | |
1081 | yyx < (int) (sizeof (yytname) / sizeof (char *)); | |
1082 | yyx++) | |
1083 | if (yycheck[yyx + yyn] == yyx) | |
10fa2066 | 1084 | { |
7093d0f5 AD |
1085 | const char *yyq = ! yycount ? ", expecting " : " or "; |
1086 | yyp = yystpcpy (yyp, yyq); | |
1087 | yyp = yystpcpy (yyp, yytname[yyx]); | |
1088 | yycount++; | |
10fa2066 RS |
1089 | } |
1090 | } | |
7093d0f5 AD |
1091 | yyerror (yymsg); |
1092 | YYSTACK_FREE (yymsg); | |
1093 | } | |
1094 | else | |
1095 | yyerror ("parse error; also virtual memory exhausted"); | |
a8289c62 | 1096 | } |
10fa2066 | 1097 | else |
b7575ffe | 1098 | #endif /* YYERROR_VERBOSE */ |
17da6427 | 1099 | yyerror ("parse error"); |
10fa2066 | 1100 | } |
10fa2066 | 1101 | goto yyerrlab1; |
10fa2066 | 1102 | |
71da9eea | 1103 | |
e8cb70b9 PB |
1104 | /*----------------------------------------------------. |
1105 | | yyerrlab1 -- error raised explicitly by an action. | | |
1106 | `----------------------------------------------------*/ | |
71da9eea | 1107 | yyerrlab1: |
10fa2066 RS |
1108 | if (yyerrstatus == 3) |
1109 | { | |
71da9eea AD |
1110 | /* If just tried and failed to reuse lookahead token after an |
1111 | error, discard it. */ | |
10fa2066 | 1112 | |
e8cb70b9 | 1113 | /* Return failure if at end of input. */ |
17da6427 | 1114 | if (yychar == YYEOF) |
10fa2066 | 1115 | YYABORT; |
7ea5e977 | 1116 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", |
17da6427 PB |
1117 | yychar, yytname[yychar1])); |
1118 | yychar = YYEMPTY; | |
10fa2066 RS |
1119 | } |
1120 | ||
71da9eea AD |
1121 | /* Else will try to reuse lookahead token after shifting the error |
1122 | token. */ | |
10fa2066 | 1123 | |
cf44a9ae | 1124 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
10fa2066 RS |
1125 | |
1126 | goto yyerrhandle; | |
1127 | ||
10fa2066 | 1128 | |
71da9eea AD |
1129 | /*-------------------------------------------------------------------. |
1130 | | yyerrdefault -- current state does not do anything special for the | | |
1131 | | error token. | | |
1132 | `-------------------------------------------------------------------*/ | |
1133 | yyerrdefault: | |
10fa2066 RS |
1134 | #if 0 |
1135 | /* This is wrong; only states that explicitly want error tokens | |
1136 | should shift them. */ | |
71da9eea AD |
1137 | |
1138 | /* If its default is to accept any token, ok. Otherwise pop it. */ | |
1139 | yyn = yydefact[yystate]; | |
1140 | if (yyn) | |
1141 | goto yydefault; | |
10fa2066 RS |
1142 | #endif |
1143 | ||
10fa2066 | 1144 | |
71da9eea AD |
1145 | /*---------------------------------------------------------------. |
1146 | | yyerrpop -- pop the current state because it cannot handle the | | |
e8cb70b9 | 1147 | | error token. | |
71da9eea AD |
1148 | `---------------------------------------------------------------*/ |
1149 | yyerrpop: | |
1150 | if (yyssp == yyss) | |
1151 | YYABORT; | |
10fa2066 RS |
1152 | yyvsp--; |
1153 | yystate = *--yyssp; | |
5af1f549 | 1154 | #if YYLSP_NEEDED |
10fa2066 RS |
1155 | yylsp--; |
1156 | #endif | |
1157 | ||
5a35a6cb | 1158 | #if YYDEBUG |
17da6427 | 1159 | if (yydebug) |
10fa2066 | 1160 | { |
7093d0f5 | 1161 | short *yyssp1 = yyss - 1; |
7ea5e977 | 1162 | YYFPRINTF (stderr, "Error: state stack now"); |
7093d0f5 | 1163 | while (yyssp1 != yyssp) |
7ea5e977 AD |
1164 | YYFPRINTF (stderr, " %d", *++yyssp1); |
1165 | YYFPRINTF (stderr, "\n"); | |
10fa2066 | 1166 | } |
5a35a6cb | 1167 | #endif |
10fa2066 | 1168 | |
71da9eea AD |
1169 | /*--------------. |
1170 | | yyerrhandle. | | |
1171 | `--------------*/ | |
1172 | yyerrhandle: | |
10fa2066 RS |
1173 | yyn = yypact[yystate]; |
1174 | if (yyn == YYFLAG) | |
1175 | goto yyerrdefault; | |
1176 | ||
1177 | yyn += YYTERROR; | |
1178 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
1179 | goto yyerrdefault; | |
1180 | ||
1181 | yyn = yytable[yyn]; | |
1182 | if (yyn < 0) | |
1183 | { | |
1184 | if (yyn == YYFLAG) | |
1185 | goto yyerrpop; | |
1186 | yyn = -yyn; | |
1187 | goto yyreduce; | |
1188 | } | |
1189 | else if (yyn == 0) | |
1190 | goto yyerrpop; | |
1191 | ||
1192 | if (yyn == YYFINAL) | |
1193 | YYACCEPT; | |
1194 | ||
7ea5e977 | 1195 | YYDPRINTF ((stderr, "Shifting error token, ")); |
10fa2066 | 1196 | |
17da6427 | 1197 | *++yyvsp = yylval; |
5af1f549 | 1198 | #if YYLSP_NEEDED |
10fa2066 RS |
1199 | *++yylsp = yylloc; |
1200 | #endif | |
1201 | ||
1202 | yystate = yyn; | |
1203 | goto yynewstate; | |
70ddf897 | 1204 | |
71da9eea AD |
1205 | |
1206 | /*-------------------------------------. | |
1207 | | yyacceptlab -- YYACCEPT comes here. | | |
1208 | `-------------------------------------*/ | |
1209 | yyacceptlab: | |
600f9b0c PE |
1210 | yyresult = 0; |
1211 | goto yyreturn; | |
71da9eea AD |
1212 | |
1213 | /*-----------------------------------. | |
1214 | | yyabortlab -- YYABORT comes here. | | |
1215 | `-----------------------------------*/ | |
1216 | yyabortlab: | |
600f9b0c PE |
1217 | yyresult = 1; |
1218 | goto yyreturn; | |
1219 | ||
1220 | /*---------------------------------------------. | |
1221 | | yyoverflowab -- parser overflow comes here. | | |
1222 | `---------------------------------------------*/ | |
1223 | yyoverflowlab: | |
1224 | yyerror ("parser stack overflow"); | |
1225 | yyresult = 2; | |
1226 | /* Fall through. */ | |
1227 | ||
1228 | yyreturn: | |
1229 | #ifndef yyoverflow | |
1230 | if (yyss != yyssa) | |
1231 | YYSTACK_FREE (yyss); | |
70ddf897 | 1232 | #endif |
600f9b0c | 1233 | return yyresult; |
be2a1a68 AD |
1234 | ]} |
1235 | ||
1236 | b4_epilogue | |
1237 | m4_if(b4_defines_flag, 0, [], | |
1238 | [#output "b4_output_header_name" | |
1239 | #ifndef b4_header_guard | |
1240 | # define b4_header_guard | |
1241 | ||
0d8bed56 | 1242 | b4_token_defines(b4_tokens) |
be2a1a68 AD |
1243 | |
1244 | #ifndef YYSTYPE | |
642cb8f8 AD |
1245 | m4_ifdef([b4_stype_line], |
1246 | [#line b4_stype_line "b4_filename" | |
1247 | ])dnl | |
be2a1a68 AD |
1248 | typedef b4_stype |
1249 | yystype; | |
1250 | # define YYSTYPE yystype | |
1251 | #endif | |
1252 | ||
1253 | m4_if(b4_pure, [0], | |
1254 | [extern YYSTYPE b4_prefix[]lval;]) | |
1255 | ||
1256 | m4_if(b4_locations_flag, [0], [], | |
1257 | [#ifndef YYLTYPE | |
1258 | typedef struct yyltype | |
1259 | { | |
1260 | int first_line; | |
1261 | int first_column; | |
1262 | int last_line; | |
1263 | int last_column; | |
1264 | } yyltype; | |
1265 | # define YYLTYPE yyltype | |
1266 | #endif | |
ff48177d | 1267 | |
be2a1a68 AD |
1268 | m4_if(b4_pure, [0], |
1269 | [extern YYLTYPE b4_prefix[]lloc;]) | |
1270 | ]) | |
1271 | #endif /* not b4_header_guard */ | |
1272 | ]) |