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