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