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