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