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