]> git.saurik.com Git - bison.git/blob - data/yacc.c
Regenerate.
[bison.git] / data / yacc.c
1 m4_divert(-1) -*- C -*-
2
3 # Yacc compatible skeleton for Bison
4
5 # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005
6 # Free Software Foundation, Inc.
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., 51 Franklin Street, Fifth Floor, Boston, MA
21 # 02110-1301 USA
22
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
34 ## ------------------------ ##
35 ## Pure/impure interfaces. ##
36 ## ------------------------ ##
37
38
39 # b4_pure_if(IF-TRUE, IF-FALSE)
40 # -----------------------------
41 # Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
42 m4_define([b4_Pure_if],
43 [b4_pure_if([m4_ifset([b4_parse_param],
44 [$1], [$2])],
45 [$2])])
46
47
48 # b4_yyerror_args
49 # ---------------
50 # Arguments passed to yyerror: user args plus yylloc.
51 m4_define([b4_yyerror_args],
52 [b4_Pure_if([b4_location_if([&yylloc, ])])dnl
53 m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
54
55
56 # b4_lex_param
57 # ------------
58 # Accumulate in b4_lex_param all the yylex arguments.
59 # b4_lex_param arrives quoted twice, but we want to keep only one level.
60 m4_define([b4_lex_param],
61 m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl
62 b4_location_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl
63 m4_ifdef([b4_lex_param], b4_lex_param)))
64
65
66
67 ## ------------ ##
68 ## Data Types. ##
69 ## ------------ ##
70
71 # b4_int_type(MIN, MAX)
72 # ---------------------
73 # Return the smallest int type able to handle numbers ranging from
74 # MIN to MAX (included). We overwrite the version from c.m4 which relies
75 # on "signed char" which is not portable to old K&R compilers.
76 m4_define([b4_int_type],
77 [m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
78 b4_ints_in($@, [-128], [127]), [1], [yysigned_char],
79
80 b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
81 b4_ints_in($@, [-32768], [32767]), [1], [short int],
82
83 m4_eval([0 <= $1]), [1], [unsigned int],
84
85 [int])])
86
87
88 ## ----------------- ##
89 ## Semantic Values. ##
90 ## ----------------- ##
91
92
93 # b4_lhs_value([TYPE])
94 # --------------------
95 # Expansion of $<TYPE>$.
96 m4_define([b4_lhs_value],
97 [(yyval[]m4_ifval([$1], [.$1]))])
98
99
100 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
101 # --------------------------------------
102 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
103 # symbols on RHS.
104 m4_define([b4_rhs_value],
105 [(yyvsp@{m4_eval([$2 - $1])@}m4_ifval([$3], [.$3]))])
106
107
108
109 ## ----------- ##
110 ## Locations. ##
111 ## ----------- ##
112
113 # b4_lhs_location()
114 # -----------------
115 # Expansion of @$.
116 m4_define([b4_lhs_location],
117 [(yyloc)])
118
119
120 # b4_rhs_location(RULE-LENGTH, NUM)
121 # ---------------------------------
122 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
123 # on RHS.
124 m4_define([b4_rhs_location],
125 [(yylsp@{m4_eval([$2 - $1])@})])
126
127
128
129 ## --------------------------------------------------------- ##
130 ## Defining symbol actions, e.g., printers and destructors. ##
131 ## --------------------------------------------------------- ##
132
133 # We do want M4 expansion after # for CPP macros.
134 m4_changecom()
135 m4_divert(0)dnl
136 @output @output_parser_name@
137 b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
138 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])[
139
140 /* As a special exception, when this file is copied by Bison into a
141 Bison output file, you may use that output file without restriction.
142 This special exception was added by the Free Software Foundation
143 in version 1.24 of Bison. */
144
145 /* Written by Richard Stallman by simplifying the original so called
146 ``semantic'' parser. */
147
148 /* All symbols defined below should begin with yy or YY, to avoid
149 infringing on user name space. This should be done even for local
150 variables, as they might otherwise be expanded by user macros.
151 There are some unavoidable exceptions within include files to
152 define necessary library symbols; they are noted "INFRINGES ON
153 USER NAME SPACE" below. */
154
155 ]b4_identification
156 m4_if(b4_prefix[], [yy], [],
157 [/* Substitute the variable and function names. */
158 #define yyparse b4_prefix[]parse
159 #define yylex b4_prefix[]lex
160 #define yyerror b4_prefix[]error
161 #define yylval b4_prefix[]lval
162 #define yychar b4_prefix[]char
163 #define yydebug b4_prefix[]debug
164 #define yynerrs b4_prefix[]nerrs
165 b4_location_if([#define yylloc b4_prefix[]lloc])])[
166
167 ]b4_token_enums_defines(b4_tokens)[
168
169 /* Copy the first part of user declarations. */
170 ]b4_pre_prologue[
171
172 /* Enabling traces. */
173 #ifndef YYDEBUG
174 # define YYDEBUG ]b4_debug[
175 #endif
176
177 /* Enabling verbose error messages. */
178 #ifdef YYERROR_VERBOSE
179 # undef YYERROR_VERBOSE
180 # define YYERROR_VERBOSE 1
181 #else
182 # define YYERROR_VERBOSE ]b4_error_verbose[
183 #endif
184
185 /* Enabling the token table. */
186 #ifndef YYTOKEN_TABLE
187 # define YYTOKEN_TABLE ]b4_token_table[
188 #endif
189
190 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
191 ]m4_ifdef([b4_stype],
192 [b4_syncline([b4_stype_line], [b4_file_name])
193 typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
194 /* Line __line__ of yacc.c. */
195 b4_syncline([@oline@], [@ofile@])],
196 [typedef int YYSTYPE;])[
197 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
198 # define YYSTYPE_IS_DECLARED 1
199 # define YYSTYPE_IS_TRIVIAL 1
200 #endif
201
202 ]b4_location_if([#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
203 typedef struct YYLTYPE
204 {
205 int first_line;
206 int first_column;
207 int last_line;
208 int last_column;
209 } YYLTYPE;
210 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
211 # define YYLTYPE_IS_DECLARED 1
212 # define YYLTYPE_IS_TRIVIAL 1
213 #endif
214 ])[
215
216 /* Copy the second part of user declarations. */
217 ]b4_post_prologue
218
219 /* Line __line__ of yacc.c. */
220 b4_syncline([@oline@], [@ofile@])[
221
222 /* Define YYMODERN_C if this compiler supports C89 or better. Some
223 modern compilers (e.g., IBM xlc 7.0) don't define __STDC__ for
224 pedantic reasons, but they define __STDC_VERSION__ so check that
225 as well. Consider a C++ compiler to be modern if it defines
226 __cplusplus. */
227 #if defined (__STDC__) || defined (__STDC_VERSION__) || defined (__cplusplus)
228 # define YYMODERN_C 1
229 #else
230 # define YYMODERN_C 0
231 #endif
232
233 #ifndef YYSIZE_T
234 # if defined (__SIZE_TYPE__)
235 # define YYSIZE_T __SIZE_TYPE__
236 # elif defined (size_t)
237 # define YYSIZE_T size_t
238 # elif ! defined (YYSIZE_T) && YYMODERN_C
239 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
240 # define YYSIZE_T size_t
241 # else
242 # define YYSIZE_T unsigned int
243 # endif
244 #endif
245
246 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
247
248 #ifndef YY_
249 # if YYENABLE_NLS
250 # if ENABLE_NLS
251 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
252 # define YY_(msgid) dgettext ("bison-runtime", msgid)
253 # endif
254 # endif
255 # ifndef YY_
256 # define YY_(msgid) msgid
257 # endif
258 #endif
259
260 /* Suppress unused-variable warnings by "using" E. */
261 #define YYUSE(e) do {;} while (/*CONSTCOND*/ 0 && (e))
262
263 #if ! defined (yyoverflow) || YYERROR_VERBOSE
264
265 /* The parser invokes alloca or malloc; define the necessary symbols. */
266
267 # ifdef YYSTACK_USE_ALLOCA
268 # if YYSTACK_USE_ALLOCA
269 # ifdef __GNUC__
270 # define YYSTACK_ALLOC __builtin_alloca
271 # elif defined (__BUILTIN_VA_ARG_INCR)
272 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
273 # elif defined (_AIX)
274 # define YYSTACK_ALLOC __alloca
275 # elif defined (_MSC_VER)
276 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
277 # define alloca _alloca
278 # else
279 # define YYSTACK_ALLOC alloca
280 # if ! defined (_ALLOCA_H) && ! defined (_STDLIB_H) && YYMODERN_C
281 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
282 # ifndef _STDLIB_H
283 # define _STDLIB_H 1
284 # endif
285 # endif
286 # endif
287 # endif
288 # endif
289
290 # ifdef YYSTACK_ALLOC
291 /* Pacify GCC's `empty if-body' warning. */
292 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
293 # ifndef YYSTACK_ALLOC_MAXIMUM
294 /* The OS might guarantee only one guard page at the bottom of the stack,
295 and a page size can be as small as 4096 bytes. So we cannot safely
296 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
297 to allow for a few compiler-allocated temporary stack slots. */
298 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
299 # endif
300 # else
301 # define YYSTACK_ALLOC YYMALLOC
302 # define YYSTACK_FREE YYFREE
303 # ifndef YYSTACK_ALLOC_MAXIMUM
304 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
305 # endif
306 # ifdef __cplusplus
307 extern "C" {
308 # endif
309 # ifndef YYMALLOC
310 # define YYMALLOC malloc
311 # if ! defined (malloc) && ! defined (_STDLIB_H) && YYMODERN_C
312 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
313 # endif
314 # endif
315 # ifndef YYFREE
316 # define YYFREE free
317 # if ! defined (free) && ! defined (_STDLIB_H) && YYMODERN_C
318 void free (void *); /* INFRINGES ON USER NAME SPACE */
319 # endif
320 # endif
321 # ifdef __cplusplus
322 }
323 # endif
324 # endif
325 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
326
327
328 #if (! defined (yyoverflow) \
329 && (! defined (__cplusplus) \
330 || (]b4_location_if([[defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
331 && ]])[defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
332
333 /* A type that is properly aligned for any stack member. */
334 union yyalloc
335 {
336 short int yyss;
337 YYSTYPE yyvs;
338 ]b4_location_if([ YYLTYPE yyls;
339 ])dnl
340 [};
341
342 /* The size of the maximum gap between one aligned stack and the next. */
343 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
344
345 /* The size of an array large to enough to hold all stacks, each with
346 N elements. */
347 ]b4_location_if(
348 [# define YYSTACK_BYTES(N) \
349 ((N) * (sizeof (short int) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
350 + 2 * YYSTACK_GAP_MAXIMUM)],
351 [# define YYSTACK_BYTES(N) \
352 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
353 + YYSTACK_GAP_MAXIMUM)])[
354
355 /* Copy COUNT objects from FROM to TO. The source and destination do
356 not overlap. */
357 # ifndef YYCOPY
358 # if defined (__GNUC__) && 1 < __GNUC__
359 # define YYCOPY(To, From, Count) \
360 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
361 # else
362 # define YYCOPY(To, From, Count) \
363 do \
364 { \
365 YYSIZE_T yyi; \
366 for (yyi = 0; yyi < (Count); yyi++) \
367 (To)[yyi] = (From)[yyi]; \
368 } \
369 while (/*CONSTCOND*/ 0)
370 # endif
371 # endif
372
373 /* Relocate STACK from its old location to the new one. The
374 local variables YYSIZE and YYSTACKSIZE give the old and new number of
375 elements in the stack, and YYPTR gives the new location of the
376 stack. Advance YYPTR to a properly aligned location for the next
377 stack. */
378 # define YYSTACK_RELOCATE(Stack) \
379 do \
380 { \
381 YYSIZE_T yynewbytes; \
382 YYCOPY (&yyptr->Stack, Stack, yysize); \
383 Stack = &yyptr->Stack; \
384 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
385 yyptr += yynewbytes / sizeof (*yyptr); \
386 } \
387 while (/*CONSTCOND*/ 0)
388
389 #endif
390
391 #if YYMODERN_C
392 typedef signed char yysigned_char;
393 #else
394 typedef short int yysigned_char;
395 #endif
396
397 /* YYFINAL -- State number of the termination state. */
398 #define YYFINAL ]b4_final_state_number[
399 /* YYLAST -- Last index in YYTABLE. */
400 #define YYLAST ]b4_last[
401
402 /* YYNTOKENS -- Number of terminals. */
403 #define YYNTOKENS ]b4_tokens_number[
404 /* YYNNTS -- Number of nonterminals. */
405 #define YYNNTS ]b4_nterms_number[
406 /* YYNRULES -- Number of rules. */
407 #define YYNRULES ]b4_rules_number[
408 /* YYNRULES -- Number of states. */
409 #define YYNSTATES ]b4_states_number[
410
411 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
412 #define YYUNDEFTOK ]b4_undef_token_number[
413 #define YYMAXUTOK ]b4_user_token_number_max[
414
415 #define YYTRANSLATE(YYX) \
416 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
417
418 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
419 static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
420 {
421 ]b4_translate[
422 };
423
424 #if YYDEBUG
425 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
426 YYRHS. */
427 static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
428 {
429 ]b4_prhs[
430 };
431
432 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
433 static const ]b4_int_type_for([b4_rhs])[ yyrhs[] =
434 {
435 ]b4_rhs[
436 };
437
438 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
439 static const ]b4_int_type_for([b4_rline])[ yyrline[] =
440 {
441 ]b4_rline[
442 };
443 #endif
444
445 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
446 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
447 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
448 static const char *const yytname[] =
449 {
450 ]b4_tname[
451 };
452 #endif
453
454 # ifdef YYPRINT
455 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
456 token YYLEX-NUM. */
457 static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
458 {
459 ]b4_toknum[
460 };
461 # endif
462
463 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
464 static const ]b4_int_type_for([b4_r1])[ yyr1[] =
465 {
466 ]b4_r1[
467 };
468
469 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
470 static const ]b4_int_type_for([b4_r2])[ yyr2[] =
471 {
472 ]b4_r2[
473 };
474
475 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
476 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
477 means the default is an error. */
478 static const ]b4_int_type_for([b4_defact])[ yydefact[] =
479 {
480 ]b4_defact[
481 };
482
483 /* YYDEFGOTO[NTERM-NUM]. */
484 static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] =
485 {
486 ]b4_defgoto[
487 };
488
489 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
490 STATE-NUM. */
491 #define YYPACT_NINF ]b4_pact_ninf[
492 static const ]b4_int_type_for([b4_pact])[ yypact[] =
493 {
494 ]b4_pact[
495 };
496
497 /* YYPGOTO[NTERM-NUM]. */
498 static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] =
499 {
500 ]b4_pgoto[
501 };
502
503 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
504 positive, shift that token. If negative, reduce the rule which
505 number is the opposite. If zero, do what YYDEFACT says.
506 If YYTABLE_NINF, syntax error. */
507 #define YYTABLE_NINF ]b4_table_ninf[
508 static const ]b4_int_type_for([b4_table])[ yytable[] =
509 {
510 ]b4_table[
511 };
512
513 static const ]b4_int_type_for([b4_check])[ yycheck[] =
514 {
515 ]b4_check[
516 };
517
518 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
519 symbol of state STATE-NUM. */
520 static const ]b4_int_type_for([b4_stos])[ yystos[] =
521 {
522 ]b4_stos[
523 };
524
525 #define yyerrok (yyerrstatus = 0)
526 #define yyclearin (yychar = YYEMPTY)
527 #define YYEMPTY (-2)
528 #define YYEOF 0
529
530 #define YYACCEPT goto yyacceptlab
531 #define YYABORT goto yyabortlab
532 #define YYERROR goto yyerrorlab
533
534
535 /* Like YYERROR except do call yyerror. This remains here temporarily
536 to ease the transition to the new meaning of YYERROR, for GCC.
537 Once GCC version 2 has supplanted version 1, this can go. */
538
539 #define YYFAIL goto yyerrlab
540
541 #define YYRECOVERING() (!!yyerrstatus)
542
543 #define YYBACKUP(Token, Value) \
544 do \
545 if (yychar == YYEMPTY && yylen == 1) \
546 { \
547 yychar = (Token); \
548 yylval = (Value); \
549 yytoken = YYTRANSLATE (yychar); \
550 YYPOPSTACK; \
551 goto yybackup; \
552 } \
553 else \
554 { \
555 yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
556 YYERROR; \
557 } \
558 while (/*CONSTCOND*/ 0)
559
560
561 #define YYTERROR 1
562 #define YYERRCODE 256
563
564
565 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
566 If N is 0, then set CURRENT to the empty location which ends
567 the previous symbol: RHS[0] (always defined). */
568
569 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
570 #ifndef YYLLOC_DEFAULT
571 # define YYLLOC_DEFAULT(Current, Rhs, N) \
572 do \
573 if (N) \
574 { \
575 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
576 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
577 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
578 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
579 } \
580 else \
581 { \
582 (Current).first_line = (Current).last_line = \
583 YYRHSLOC (Rhs, 0).last_line; \
584 (Current).first_column = (Current).last_column = \
585 YYRHSLOC (Rhs, 0).last_column; \
586 } \
587 while (/*CONSTCOND*/ 0)
588 #endif
589
590
591 /* YY_LOCATION_PRINT -- Print the location on the stream.
592 This macro was not mandated originally: define only if we know
593 we won't break user code: when these are the locations we know. */
594
595 #ifndef YY_LOCATION_PRINT
596 # if YYLTYPE_IS_TRIVIAL
597 # define YY_LOCATION_PRINT(File, Loc) \
598 fprintf (File, "%d.%d-%d.%d", \
599 (Loc).first_line, (Loc).first_column, \
600 (Loc).last_line, (Loc).last_column)
601 # else
602 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
603 # endif
604 #endif
605
606
607 /* YYLEX -- calling `yylex' with the right arguments. */
608
609 #ifdef YYLEX_PARAM
610 # define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM)
611 #else
612 # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
613 #endif
614
615 /* Enable debugging if requested. */
616 #if YYDEBUG
617
618 # ifndef YYFPRINTF
619 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
620 # define YYFPRINTF fprintf
621 # endif
622
623 # define YYDPRINTF(Args) \
624 do { \
625 if (yydebug) \
626 YYFPRINTF Args; \
627 } while (/*CONSTCOND*/ 0)
628
629 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
630 do { \
631 if (yydebug) \
632 { \
633 YYFPRINTF (stderr, "%s ", Title); \
634 yysymprint (stderr, \
635 Type, Value]b4_location_if([, Location])[); \
636 YYFPRINTF (stderr, "\n"); \
637 } \
638 } while (/*CONSTCOND*/ 0)
639
640 /*------------------------------------------------------------------.
641 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
642 | TOP (included). |
643 `------------------------------------------------------------------*/
644
645 ]b4_c_function_def([yy_stack_print], [static void],
646 [[short int *bottom], [bottom]],
647 [[short int *top], [top]])[
648 {
649 YYFPRINTF (stderr, "Stack now");
650 for (/* Nothing. */; bottom <= top; ++bottom)
651 YYFPRINTF (stderr, " %d", *bottom);
652 YYFPRINTF (stderr, "\n");
653 }
654
655 # define YY_STACK_PRINT(Bottom, Top) \
656 do { \
657 if (yydebug) \
658 yy_stack_print ((Bottom), (Top)); \
659 } while (/*CONSTCOND*/ 0)
660
661
662 /*------------------------------------------------.
663 | Report that the YYRULE is going to be reduced. |
664 `------------------------------------------------*/
665
666 ]b4_c_function_def([yy_reduce_print], [static void],
667 [[int yyrule], [yyrule]])[
668 {
669 int yyi;
670 unsigned long int yylno = yyrline[yyrule];
671 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
672 yyrule - 1, yylno);
673 /* Print the symbols being reduced, and their result. */
674 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
675 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
676 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
677 }
678
679 # define YY_REDUCE_PRINT(Rule) \
680 do { \
681 if (yydebug) \
682 yy_reduce_print (Rule); \
683 } while (/*CONSTCOND*/ 0)
684
685 /* Nonzero means print parse trace. It is left uninitialized so that
686 multiple parsers can coexist. */
687 int yydebug;
688 #else /* !YYDEBUG */
689 # define YYDPRINTF(Args)
690 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
691 # define YY_STACK_PRINT(Bottom, Top)
692 # define YY_REDUCE_PRINT(Rule)
693 #endif /* !YYDEBUG */
694
695
696 /* YYINITDEPTH -- initial size of the parser's stacks. */
697 #ifndef YYINITDEPTH
698 # define YYINITDEPTH ]b4_stack_depth_init[
699 #endif
700
701 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
702 if the built-in stack extension method is used).
703
704 Do not make this value too large; the results are undefined if
705 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
706 evaluated with infinite-precision integer arithmetic. */
707
708 #ifndef YYMAXDEPTH
709 # define YYMAXDEPTH ]b4_stack_depth_max[
710 #endif
711
712 \f
713
714 #if YYERROR_VERBOSE
715
716 # ifndef yystrlen
717 # if defined (__GLIBC__) && defined (_STRING_H)
718 # define yystrlen strlen
719 # else
720 /* Return the length of YYSTR. */
721 static YYSIZE_T
722 # if YYMODERN_C
723 yystrlen (const char *yystr)
724 # else
725 yystrlen (yystr)
726 const char *yystr;
727 # endif
728 {
729 const char *yys = yystr;
730
731 while (*yys++ != '\0')
732 continue;
733
734 return yys - yystr - 1;
735 }
736 # endif
737 # endif
738
739 # ifndef yystpcpy
740 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
741 # define yystpcpy stpcpy
742 # else
743 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
744 YYDEST. */
745 static char *
746 # if YYMODERN_C
747 yystpcpy (char *yydest, const char *yysrc)
748 # else
749 yystpcpy (yydest, yysrc)
750 char *yydest;
751 const char *yysrc;
752 # endif
753 {
754 char *yyd = yydest;
755 const char *yys = yysrc;
756
757 while ((*yyd++ = *yys++) != '\0')
758 continue;
759
760 return yyd - 1;
761 }
762 # endif
763 # endif
764
765 # ifndef yytnamerr
766 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
767 quotes and backslashes, so that it's suitable for yyerror. The
768 heuristic is that double-quoting is unnecessary unless the string
769 contains an apostrophe, a comma, or backslash (other than
770 backslash-backslash). YYSTR is taken from yytname. If YYRES is
771 null, do not copy; instead, return the length of what the result
772 would have been. */
773 static YYSIZE_T
774 yytnamerr (char *yyres, const char *yystr)
775 {
776 if (*yystr == '"')
777 {
778 size_t yyn = 0;
779 char const *yyp = yystr;
780
781 for (;;)
782 switch (*++yyp)
783 {
784 case '\'':
785 case ',':
786 goto do_not_strip_quotes;
787
788 case '\\':
789 if (*++yyp != '\\')
790 goto do_not_strip_quotes;
791 /* Fall through. */
792 default:
793 if (yyres)
794 yyres[yyn] = *yyp;
795 yyn++;
796 break;
797
798 case '"':
799 if (yyres)
800 yyres[yyn] = '\0';
801 return yyn;
802 }
803 do_not_strip_quotes: ;
804 }
805
806 if (! yyres)
807 return yystrlen (yystr);
808
809 return yystpcpy (yyres, yystr) - yyres;
810 }
811 # endif
812
813 /* Copy into YYRESULT an error message about the unexpected token
814 YYCHAR while in state YYSTATE. Return the number of bytes copied,
815 including the terminating null byte. If YYRESULT is null, do not
816 copy anything; just return the number of bytes that would be
817 copied. As a special case, return 0 if an ordinary "syntax error"
818 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
819 size calculation. */
820 static YYSIZE_T
821 yysyntax_error (char *yyresult, int yystate, int yychar)
822 {
823 int yyn = yypact[yystate];
824
825 if (! (YYPACT_NINF < yyn && yyn < YYLAST))
826 return 0;
827 else
828 {
829 int yytype = YYTRANSLATE (yychar);
830 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
831 YYSIZE_T yysize = yysize0;
832 YYSIZE_T yysize1;
833 int yysize_overflow = 0;
834 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
835 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
836 int yyx;
837
838 # if 0
839 /* This is so xgettext sees the translatable formats that are
840 constructed on the fly. */
841 YY_("syntax error, unexpected %s");
842 YY_("syntax error, unexpected %s, expecting %s");
843 YY_("syntax error, unexpected %s, expecting %s or %s");
844 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
845 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
846 # endif
847 char *yyfmt;
848 char const *yyf;
849 static char const yyunexpected[] = "syntax error, unexpected %s";
850 static char const yyexpecting[] = ", expecting %s";
851 static char const yyor[] = " or %s";
852 char yyformat[sizeof yyunexpected
853 + sizeof yyexpecting - 1
854 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
855 * (sizeof yyor - 1))];
856 char const *yyprefix = yyexpecting;
857
858 /* Start YYX at -YYN if negative to avoid negative indexes in
859 YYCHECK. */
860 int yyxbegin = yyn < 0 ? -yyn : 0;
861
862 /* Stay within bounds of both yycheck and yytname. */
863 int yychecklim = YYLAST - yyn;
864 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
865 int yycount = 1;
866
867 yyarg[0] = yytname[yytype];
868 yyfmt = yystpcpy (yyformat, yyunexpected);
869
870 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
871 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
872 {
873 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
874 {
875 yycount = 1;
876 yysize = yysize0;
877 yyformat[sizeof yyunexpected - 1] = '\0';
878 break;
879 }
880 yyarg[yycount++] = yytname[yyx];
881 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
882 yysize_overflow |= yysize1 < yysize;
883 yysize = yysize1;
884 yyfmt = yystpcpy (yyfmt, yyprefix);
885 yyprefix = yyor;
886 }
887
888 yyf = YY_(yyformat);
889 yysize1 = yysize + yystrlen (yyf);
890 yysize_overflow |= yysize1 < yysize;
891 yysize = yysize1;
892
893 if (yysize_overflow)
894 return YYSIZE_MAXIMUM;
895
896 if (yyresult)
897 {
898 /* Avoid sprintf, as that infringes on the user's name space.
899 Don't have undefined behavior even if the translation
900 produced a string with the wrong number of "%s"s. */
901 char *yyp = yyresult;
902 int yyi = 0;
903 while ((*yyp = *yyf))
904 {
905 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
906 {
907 yyp += yytnamerr (yyp, yyarg[yyi++]);
908 yyf += 2;
909 }
910 else
911 {
912 yyp++;
913 yyf++;
914 }
915 }
916 }
917 return yysize;
918 }
919 }
920 #endif /* YYERROR_VERBOSE */
921 \f
922
923 #if YYDEBUG
924 ]b4_yysymprint_generate([b4_c_function_def])[
925 #endif /* ! YYDEBUG */
926 ]b4_yydestruct_generate([b4_c_function_def])
927 \f
928
929 /* Prevent warnings from -Wmissing-prototypes. */
930
931 #ifdef YYPARSE_PARAM
932 # if YYMODERN_C
933 int yyparse (void *YYPARSE_PARAM);
934 # else
935 int yyparse ();
936 # endif
937 #else /* ! YYPARSE_PARAM */
938 b4_c_function_decl([yyparse], [int], b4_parse_param)
939 #endif /* ! YYPARSE_PARAM */
940
941
942 m4_divert_push([KILL])# ======================== M4 code.
943 # b4_declare_parser_variables
944 # ---------------------------
945 # Declare the variables that are global, or local to YYPARSE if
946 # pure-parser.
947 m4_define([b4_declare_parser_variables],
948 [/* The look-ahead symbol. */
949 int yychar;
950
951 /* The semantic value of the look-ahead symbol. */
952 YYSTYPE yylval;
953
954 /* Number of syntax errors so far. */
955 int yynerrs;b4_location_if([
956 /* Location data for the look-ahead symbol. */
957 YYLTYPE yylloc;])
958 ])
959 m4_divert_pop([KILL])dnl# ====================== End of M4 code.
960
961 b4_pure_if([],
962 [b4_declare_parser_variables])
963
964
965 /*----------.
966 | yyparse. |
967 `----------*/
968
969 #ifdef YYPARSE_PARAM
970 # if YYMODERN_C
971 int yyparse (void *YYPARSE_PARAM)
972 # else
973 int yyparse (YYPARSE_PARAM)
974 void *YYPARSE_PARAM;
975 # endif
976 #else /* ! YYPARSE_PARAM */
977 b4_c_function_def([yyparse], [int], b4_parse_param)
978 #endif
979 {[
980 ]b4_pure_if([b4_declare_parser_variables])[
981 int yystate;
982 int yyn;
983 int yyresult;
984 /* Number of tokens to shift before error messages enabled. */
985 int yyerrstatus;
986 /* Look-ahead token as an internal (translated) token number. */
987 int yytoken = 0;
988 #if YYERROR_VERBOSE
989 /* Buffer for error messages, and its allocated size. */
990 char yymsgbuf[128];
991 char *yymsg = yymsgbuf;
992 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
993 #endif
994
995 /* Three stacks and their tools:
996 `yyss': related to states,
997 `yyvs': related to semantic values,
998 `yyls': related to locations.
999
1000 Refer to the stacks thru separate pointers, to allow yyoverflow
1001 to reallocate them elsewhere. */
1002
1003 /* The state stack. */
1004 short int yyssa[YYINITDEPTH];
1005 short int *yyss = yyssa;
1006 short int *yyssp;
1007
1008 /* The semantic value stack. */
1009 YYSTYPE yyvsa[YYINITDEPTH];
1010 YYSTYPE *yyvs = yyvsa;
1011 YYSTYPE *yyvsp;
1012
1013 ]b4_location_if(
1014 [[ /* The location stack. */
1015 YYLTYPE yylsa[YYINITDEPTH];
1016 YYLTYPE *yyls = yylsa;
1017 YYLTYPE *yylsp;
1018 /* The locations where the error started and ended. */
1019 YYLTYPE yyerror_range[2];]])[
1020
1021 #define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
1022
1023 YYSIZE_T yystacksize = YYINITDEPTH;
1024
1025 /* The variables used to return semantic value and location from the
1026 action routines. */
1027 YYSTYPE yyval;
1028 ]b4_location_if([ YYLTYPE yyloc;])[
1029
1030 /* When reducing, the number of symbols on the RHS of the reduced
1031 rule. */
1032 int yylen;
1033
1034 YYDPRINTF ((stderr, "Starting parse\n"));
1035
1036 yystate = 0;
1037 yyerrstatus = 0;
1038 yynerrs = 0;
1039 yychar = YYEMPTY; /* Cause a token to be read. */
1040
1041 /* Initialize stack pointers.
1042 Waste one element of value and location stack
1043 so that they stay on the same level as the state stack.
1044 The wasted elements are never initialized. */
1045
1046 yyssp = yyss;
1047 yyvsp = yyvs;
1048 ]b4_location_if([[ yylsp = yyls;
1049 #if YYLTYPE_IS_TRIVIAL
1050 /* Initialize the default location before parsing starts. */
1051 yylloc.first_line = yylloc.last_line = 1;
1052 yylloc.first_column = yylloc.last_column = 0;
1053 #endif
1054 ]])
1055 m4_ifdef([b4_initial_action], [
1056 m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl
1057 m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl
1058 /* User initialization code. */
1059 b4_initial_action
1060 m4_popdef([b4_dollar_dollar])dnl
1061 m4_popdef([b4_at_dollar])dnl
1062 /* Line __line__ of yacc.c. */
1063 b4_syncline([@oline@], [@ofile@])
1064 ])dnl
1065 m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
1066 ]])dnl
1067 m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
1068 ]])dnl
1069 [ goto yysetstate;
1070
1071 /*------------------------------------------------------------.
1072 | yynewstate -- Push a new state, which is found in yystate. |
1073 `------------------------------------------------------------*/
1074 yynewstate:
1075 /* In all cases, when you get here, the value and location stacks
1076 have just been pushed. so pushing a state here evens the stacks.
1077 */
1078 yyssp++;
1079
1080 yysetstate:
1081 *yyssp = yystate;
1082
1083 if (yyss + yystacksize - 1 <= yyssp)
1084 {
1085 /* Get the current used size of the three stacks, in elements. */
1086 YYSIZE_T yysize = yyssp - yyss + 1;
1087
1088 #ifdef yyoverflow
1089 {
1090 /* Give user a chance to reallocate the stack. Use copies of
1091 these so that the &'s don't force the real ones into
1092 memory. */
1093 YYSTYPE *yyvs1 = yyvs;
1094 short int *yyss1 = yyss;
1095 ]b4_location_if([ YYLTYPE *yyls1 = yyls;])[
1096
1097 /* Each stack pointer address is followed by the size of the
1098 data in use in that stack, in bytes. This used to be a
1099 conditional around just the two extra args, but that might
1100 be undefined if yyoverflow is a macro. */
1101 yyoverflow (YY_("memory exhausted"),
1102 &yyss1, yysize * sizeof (*yyssp),
1103 &yyvs1, yysize * sizeof (*yyvsp),
1104 ]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[
1105 &yystacksize);
1106 ]b4_location_if([ yyls = yyls1;])[
1107 yyss = yyss1;
1108 yyvs = yyvs1;
1109 }
1110 #else /* no yyoverflow */
1111 # ifndef YYSTACK_RELOCATE
1112 goto yyexhaustedlab;
1113 # else
1114 /* Extend the stack our own way. */
1115 if (YYMAXDEPTH <= yystacksize)
1116 goto yyexhaustedlab;
1117 yystacksize *= 2;
1118 if (YYMAXDEPTH < yystacksize)
1119 yystacksize = YYMAXDEPTH;
1120
1121 {
1122 short int *yyss1 = yyss;
1123 union yyalloc *yyptr =
1124 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1125 if (! yyptr)
1126 goto yyexhaustedlab;
1127 YYSTACK_RELOCATE (yyss);
1128 YYSTACK_RELOCATE (yyvs);
1129 ]b4_location_if([ YYSTACK_RELOCATE (yyls);])[
1130 # undef YYSTACK_RELOCATE
1131 if (yyss1 != yyssa)
1132 YYSTACK_FREE (yyss1);
1133 }
1134 # endif
1135 #endif /* no yyoverflow */
1136
1137 yyssp = yyss + yysize - 1;
1138 yyvsp = yyvs + yysize - 1;
1139 ]b4_location_if([ yylsp = yyls + yysize - 1;])[
1140
1141 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1142 (unsigned long int) yystacksize));
1143
1144 if (yyss + yystacksize - 1 <= yyssp)
1145 YYABORT;
1146 }
1147
1148 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1149
1150 goto yybackup;
1151
1152 /*-----------.
1153 | yybackup. |
1154 `-----------*/
1155 yybackup:
1156
1157 /* Do appropriate processing given the current state. */
1158 /* Read a look-ahead token if we need one and don't already have one. */
1159 /* yyresume: */
1160
1161 /* First try to decide what to do without reference to look-ahead token. */
1162
1163 yyn = yypact[yystate];
1164 if (yyn == YYPACT_NINF)
1165 goto yydefault;
1166
1167 /* Not known => get a look-ahead token if don't already have one. */
1168
1169 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1170 if (yychar == YYEMPTY)
1171 {
1172 YYDPRINTF ((stderr, "Reading a token: "));
1173 yychar = YYLEX;
1174 }
1175
1176 if (yychar <= YYEOF)
1177 {
1178 yychar = yytoken = YYEOF;
1179 YYDPRINTF ((stderr, "Now at end of input.\n"));
1180 }
1181 else
1182 {
1183 yytoken = YYTRANSLATE (yychar);
1184 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1185 }
1186
1187 /* If the proper action on seeing token YYTOKEN is to reduce or to
1188 detect an error, take that action. */
1189 yyn += yytoken;
1190 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1191 goto yydefault;
1192 yyn = yytable[yyn];
1193 if (yyn <= 0)
1194 {
1195 if (yyn == 0 || yyn == YYTABLE_NINF)
1196 goto yyerrlab;
1197 yyn = -yyn;
1198 goto yyreduce;
1199 }
1200
1201 if (yyn == YYFINAL)
1202 YYACCEPT;
1203
1204 /* Shift the look-ahead token. */
1205 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1206
1207 /* Discard the token being shifted unless it is eof. */
1208 if (yychar != YYEOF)
1209 yychar = YYEMPTY;
1210
1211 *++yyvsp = yylval;
1212 ]b4_location_if([ *++yylsp = yylloc;])[
1213
1214 /* Count tokens shifted since error; after three, turn off error
1215 status. */
1216 if (yyerrstatus)
1217 yyerrstatus--;
1218
1219 yystate = yyn;
1220 goto yynewstate;
1221
1222
1223 /*-----------------------------------------------------------.
1224 | yydefault -- do the default action for the current state. |
1225 `-----------------------------------------------------------*/
1226 yydefault:
1227 yyn = yydefact[yystate];
1228 if (yyn == 0)
1229 goto yyerrlab;
1230 goto yyreduce;
1231
1232
1233 /*-----------------------------.
1234 | yyreduce -- Do a reduction. |
1235 `-----------------------------*/
1236 yyreduce:
1237 /* yyn is the number of a rule to reduce with. */
1238 yylen = yyr2[yyn];
1239
1240 /* If YYLEN is nonzero, implement the default value of the action:
1241 `$$ = $1'.
1242
1243 Otherwise, the following line sets YYVAL to garbage.
1244 This behavior is undocumented and Bison
1245 users should not rely upon it. Assigning to YYVAL
1246 unconditionally makes the parser a bit smaller, and it avoids a
1247 GCC warning that YYVAL may be used uninitialized. */
1248 yyval = yyvsp[1-yylen];
1249
1250 ]b4_location_if(
1251 [[ /* Default location. */
1252 YYLLOC_DEFAULT (yyloc, yylsp - yylen, yylen);]])[
1253 YY_REDUCE_PRINT (yyn);
1254 switch (yyn)
1255 ]{
1256 b4_actions
1257 default: break;
1258 }
1259
1260 /* Line __line__ of yacc.c. */
1261 b4_syncline([@oline@], [@ofile@])
1262 \f
1263 [ yyvsp -= yylen;
1264 yyssp -= yylen;
1265 ]b4_location_if([ yylsp -= yylen;])[
1266
1267 YY_STACK_PRINT (yyss, yyssp);
1268
1269 *++yyvsp = yyval;
1270 ]b4_location_if([ *++yylsp = yyloc;])[
1271
1272 /* Now `shift' the result of the reduction. Determine what state
1273 that goes to, based on the state we popped back to and the rule
1274 number reduced by. */
1275
1276 yyn = yyr1[yyn];
1277
1278 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1279 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1280 yystate = yytable[yystate];
1281 else
1282 yystate = yydefgoto[yyn - YYNTOKENS];
1283
1284 goto yynewstate;
1285
1286
1287 /*------------------------------------.
1288 | yyerrlab -- here on detecting error |
1289 `------------------------------------*/
1290 yyerrlab:
1291 /* If not already recovering from an error, report this error. */
1292 if (!yyerrstatus)
1293 {
1294 ++yynerrs;
1295 #if ! YYERROR_VERBOSE
1296 yyerror (]b4_yyerror_args[YY_("syntax error"));
1297 #else
1298 {
1299 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1300 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1301 {
1302 YYSIZE_T yyalloc = 2 * yysize;
1303 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1304 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1305 if (yymsg != yymsgbuf)
1306 YYSTACK_FREE (yymsg);
1307 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1308 if (yymsg)
1309 yymsg_alloc = yyalloc;
1310 else
1311 {
1312 yymsg = yymsgbuf;
1313 yymsg_alloc = sizeof yymsgbuf;
1314 }
1315 }
1316
1317 if (0 < yysize && yysize <= yymsg_alloc)
1318 {
1319 (void) yysyntax_error (yymsg, yystate, yychar);
1320 yyerror (]b4_yyerror_args[yymsg);
1321 }
1322 else
1323 {
1324 yyerror (]b4_yyerror_args[YY_("syntax error"));
1325 if (yysize != 0)
1326 goto yyexhaustedlab;
1327 }
1328 }
1329 #endif
1330 }
1331
1332 ]b4_location_if([[ yyerror_range[0] = yylloc;]])[
1333
1334 if (yyerrstatus == 3)
1335 {
1336 /* If just tried and failed to reuse look-ahead token after an
1337 error, discard it. */
1338
1339 if (yychar <= YYEOF)
1340 {
1341 /* Return failure if at end of input. */
1342 if (yychar == YYEOF)
1343 YYABORT;
1344 }
1345 else
1346 {
1347 yydestruct ("Error: discarding", yytoken, &yylval]b4_location_if([, &yylloc])[);
1348 yychar = YYEMPTY;
1349 }
1350 }
1351
1352 /* Else will try to reuse look-ahead token after shifting the error
1353 token. */
1354 goto yyerrlab1;
1355
1356
1357 /*---------------------------------------------------.
1358 | yyerrorlab -- error raised explicitly by YYERROR. |
1359 `---------------------------------------------------*/
1360 yyerrorlab:
1361
1362 /* Pacify compilers like GCC when the user code never invokes
1363 YYERROR and the label yyerrorlab therefore never appears in user
1364 code. */
1365 if (/*CONSTCOND*/ 0)
1366 goto yyerrorlab;
1367
1368 ]b4_location_if([[ yyerror_range[0] = yylsp[1-yylen];
1369 yylsp -= yylen;
1370 ]])[yyvsp -= yylen;
1371 yyssp -= yylen;
1372 yystate = *yyssp;
1373 goto yyerrlab1;
1374
1375
1376 /*-------------------------------------------------------------.
1377 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1378 `-------------------------------------------------------------*/
1379 yyerrlab1:
1380 yyerrstatus = 3; /* Each real token shifted decrements this. */
1381
1382 for (;;)
1383 {
1384 yyn = yypact[yystate];
1385 if (yyn != YYPACT_NINF)
1386 {
1387 yyn += YYTERROR;
1388 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1389 {
1390 yyn = yytable[yyn];
1391 if (0 < yyn)
1392 break;
1393 }
1394 }
1395
1396 /* Pop the current state because it cannot handle the error token. */
1397 if (yyssp == yyss)
1398 YYABORT;
1399
1400 ]b4_location_if([[ yyerror_range[0] = *yylsp;]])[
1401 yydestruct ("Error: popping", yystos[yystate], yyvsp]b4_location_if([, yylsp])[);
1402 YYPOPSTACK;
1403 yystate = *yyssp;
1404 YY_STACK_PRINT (yyss, yyssp);
1405 }
1406
1407 if (yyn == YYFINAL)
1408 YYACCEPT;
1409
1410 *++yyvsp = yylval;
1411 ]b4_location_if([[
1412 yyerror_range[1] = yylloc;
1413 /* Using YYLLOC is tempting, but would change the location of
1414 the look-ahead. YYLOC is available though. */
1415 YYLLOC_DEFAULT (yyloc, yyerror_range - 1, 2);
1416 *++yylsp = yyloc;]])[
1417
1418 /* Shift the error token. */
1419 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1420
1421 yystate = yyn;
1422 goto yynewstate;
1423
1424
1425 /*-------------------------------------.
1426 | yyacceptlab -- YYACCEPT comes here. |
1427 `-------------------------------------*/
1428 yyacceptlab:
1429 yyresult = 0;
1430 goto yyreturn;
1431
1432 /*-----------------------------------.
1433 | yyabortlab -- YYABORT comes here. |
1434 `-----------------------------------*/
1435 yyabortlab:
1436 yyresult = 1;
1437 goto yyreturn;
1438
1439 #ifndef yyoverflow
1440 /*-------------------------------------------------.
1441 | yyexhaustedlab -- memory exhaustion comes here. |
1442 `-------------------------------------------------*/
1443 yyexhaustedlab:
1444 yyerror (]b4_yyerror_args[YY_("memory exhausted"));
1445 yyresult = 2;
1446 /* Fall through. */
1447 #endif
1448
1449 yyreturn:
1450 if (yychar != YYEOF && yychar != YYEMPTY)
1451 yydestruct ("Cleanup: discarding lookahead",
1452 yytoken, &yylval]b4_location_if([, &yylloc])[);
1453 while (yyssp != yyss)
1454 {
1455 yydestruct ("Cleanup: popping",
1456 yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[);
1457 YYPOPSTACK;
1458 }
1459 #ifndef yyoverflow
1460 if (yyss != yyssa)
1461 YYSTACK_FREE (yyss);
1462 #endif
1463 #if YYERROR_VERBOSE
1464 if (yymsg != yymsgbuf)
1465 YYSTACK_FREE (yymsg);
1466 #endif
1467 return yyresult;
1468 ]}
1469
1470
1471 b4_epilogue
1472 m4_if(b4_defines_flag, 0, [],
1473 [@output @output_header_name@
1474 b4_copyright([Skeleton parser for Yacc-like parsing with Bison],
1475 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005])
1476
1477 /* As a special exception, when this file is copied by Bison into a
1478 Bison output file, you may use that output file without restriction.
1479 This special exception was added by the Free Software Foundation
1480 in version 1.24 of Bison. */
1481
1482 b4_token_enums_defines(b4_tokens)
1483
1484 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1485 m4_ifdef([b4_stype],
1486 [b4_syncline([b4_stype_line], [b4_file_name])
1487 typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
1488 /* Line __line__ of yacc.c. */
1489 b4_syncline([@oline@], [@ofile@])],
1490 [typedef int YYSTYPE;])
1491 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1492 # define YYSTYPE_IS_DECLARED 1
1493 # define YYSTYPE_IS_TRIVIAL 1
1494 #endif
1495
1496 b4_pure_if([],
1497 [extern YYSTYPE b4_prefix[]lval;])
1498
1499 b4_location_if(
1500 [#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED)
1501 typedef struct YYLTYPE
1502 {
1503 int first_line;
1504 int first_column;
1505 int last_line;
1506 int last_column;
1507 } YYLTYPE;
1508 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
1509 # define YYLTYPE_IS_DECLARED 1
1510 # define YYLTYPE_IS_TRIVIAL 1
1511 #endif
1512
1513 m4_if(b4_pure, [0],
1514 [extern YYLTYPE b4_prefix[]lloc;])
1515 ])
1516 ])