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