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