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