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