]> git.saurik.com Git - bison.git/blob - data/yacc.c
b6758c695fd519b388615ecb2beab6b1b93bf25a
[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,
6 # 2006, 2007, 2008, 2009, 2010 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 3 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, see <http://www.gnu.org/licenses/>.
20
21 # Check the value of %define api.push-pull.
22 b4_percent_define_default([[api.push-pull]], [[pull]])
23 b4_percent_define_check_values([[[[api.push-pull]],
24 [[pull]], [[push]], [[both]]]])
25 b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
26 b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
27 m4_case(b4_percent_define_get([[api.push-pull]]),
28 [pull], [m4_define([b4_push_flag], [[0]])],
29 [push], [m4_define([b4_pull_flag], [[0]])])
30
31 # Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing
32 # tests function as written, don't let BISON_USE_PUSH_FOR_PULL modify Bison's
33 # behavior at all when push parsing is already requested.
34 b4_define_flag_if([use_push_for_pull])
35 b4_use_push_for_pull_if([
36 b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
37 [m4_define([b4_push_flag], [[1]])])])
38
39 # Check the value of %define parse.lac, where LAC stands for lookahead
40 # correction.
41 b4_percent_define_default([[parse.lac]], [[none]])
42 b4_percent_define_default([[parse.lac.es-capacity]], [[20]])
43 b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]])
44 b4_define_flag_if([lac])
45 m4_define([b4_lac_flag],
46 [m4_if(b4_percent_define_get([[parse.lac]]),
47 [none], [[0]], [[1]])])
48
49 m4_include(b4_pkgdatadir/[c.m4])
50
51 ## ---------------- ##
52 ## Default values. ##
53 ## ---------------- ##
54
55 # Stack parameters.
56 m4_define_default([b4_stack_depth_max], [10000])
57 m4_define_default([b4_stack_depth_init], [200])
58
59
60 ## ------------------------ ##
61 ## Pure/impure interfaces. ##
62 ## ------------------------ ##
63
64 b4_percent_define_default([[api.pure]], [[false]])
65 b4_define_flag_if([pure])
66 m4_define([b4_pure_flag],
67 [b4_percent_define_flag_if([[api.pure]], [[1]], [[0]])])
68
69 # b4_yacc_pure_if(IF-TRUE, IF-FALSE)
70 # ----------------------------------
71 # Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
72 m4_define([b4_yacc_pure_if],
73 [b4_pure_if([m4_ifset([b4_parse_param],
74 [$1], [$2])],
75 [$2])])
76
77
78 # b4_yyerror_args
79 # ---------------
80 # Arguments passed to yyerror: user args plus yylloc.
81 m4_define([b4_yyerror_args],
82 [b4_yacc_pure_if([b4_locations_if([&yylloc, ])])dnl
83 m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
84
85
86 # b4_lex_param
87 # ------------
88 # Accumulate in b4_lex_param all the yylex arguments.
89 # b4_lex_param arrives quoted twice, but we want to keep only one level.
90 m4_define([b4_lex_param],
91 m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl
92 b4_locations_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl
93 m4_ifdef([b4_lex_param], b4_lex_param)))
94
95
96 ## ------------ ##
97 ## Data Types. ##
98 ## ------------ ##
99
100 # b4_int_type(MIN, MAX)
101 # ---------------------
102 # Return the smallest int type able to handle numbers ranging from
103 # MIN to MAX (included). Overwrite the version from c.m4, which
104 # uses only C89 types, so that the user can override the shorter
105 # types, and so that pre-C89 compilers are handled correctly.
106 m4_define([b4_int_type],
107 [m4_if(b4_ints_in($@, [0], [255]), [1], [yytype_uint8],
108 b4_ints_in($@, [-128], [127]), [1], [yytype_int8],
109
110 b4_ints_in($@, [0], [65535]), [1], [yytype_uint16],
111 b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16],
112
113 m4_eval([0 <= $1]), [1], [unsigned int],
114
115 [int])])
116
117
118 ## ----------------- ##
119 ## Semantic Values. ##
120 ## ----------------- ##
121
122
123 # b4_lhs_value([TYPE])
124 # --------------------
125 # Expansion of $<TYPE>$.
126 m4_define([b4_lhs_value],
127 [(yyval[]m4_ifval([$1], [.$1]))])
128
129
130 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
131 # --------------------------------------
132 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
133 # symbols on RHS.
134 m4_define([b4_rhs_value],
135 [(yyvsp@{($2) - ($1)@}m4_ifval([$3], [.$3]))])
136
137
138
139 ## ----------- ##
140 ## Locations. ##
141 ## ----------- ##
142
143 # b4_lhs_location()
144 # -----------------
145 # Expansion of @$.
146 m4_define([b4_lhs_location],
147 [(yyloc)])
148
149
150 # b4_rhs_location(RULE-LENGTH, NUM)
151 # ---------------------------------
152 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
153 # on RHS.
154 m4_define([b4_rhs_location],
155 [(yylsp@{($2) - ($1)@})])
156
157
158 ## ------------------ ##
159 ## Parser variables. ##
160 ## ------------------ ##
161
162 # b4_declare_scanner_communication_variables
163 # ------------------------------------------
164 # Declare the variables that are global, or local to YYPARSE if
165 # pure-parser.
166 m4_define([b4_declare_scanner_communication_variables], [[
167 /* The lookahead symbol. */
168 int yychar;
169
170 /* The semantic value of the lookahead symbol. */
171 YYSTYPE yylval;]b4_locations_if([[
172
173 /* Location data for the lookahead symbol. */
174 YYLTYPE yylloc;]])b4_pure_if([], [[
175
176 /* Number of syntax errors so far. */
177 int yynerrs;]])])
178
179
180 # b4_declare_parser_state_variables
181 # ---------------------------------
182 # Declare all the variables that are needed to maintain the parser state
183 # between calls to yypush_parse.
184 m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
185 /* Number of syntax errors so far. */
186 int yynerrs;
187 ]])[
188 int yystate;
189 /* Number of tokens to shift before error messages enabled. */
190 int yyerrstatus;
191
192 /* The stacks and their tools:
193 `yyss': related to states.
194 `yyvs': related to semantic values.]b4_locations_if([[
195 `yyls': related to locations.]])[
196
197 Refer to the stacks thru separate pointers, to allow yyoverflow
198 to reallocate them elsewhere. */
199
200 /* The state stack. */
201 yytype_int16 yyssa[YYINITDEPTH];
202 yytype_int16 *yyss;
203 yytype_int16 *yyssp;
204
205 /* The semantic value stack. */
206 YYSTYPE yyvsa[YYINITDEPTH];
207 YYSTYPE *yyvs;
208 YYSTYPE *yyvsp;]b4_locations_if([[
209
210 /* The location stack. */
211 YYLTYPE yylsa[YYINITDEPTH];
212 YYLTYPE *yyls;
213 YYLTYPE *yylsp;
214
215 /* The locations where the error started and ended. */
216 YYLTYPE yyerror_range[3];]])[
217
218 YYSIZE_T yystacksize;]])
219
220
221 ## --------------------------------------------------------- ##
222 ## Defining symbol actions, e.g., printers and destructors. ##
223 ## --------------------------------------------------------- ##
224
225 # We do want M4 expansion after # for CPP macros.
226 m4_changecom()
227 m4_divert_push(0)dnl
228 @output(b4_parser_file_name@)@
229 b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],
230 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010])[
231
232 /* C LALR(1) parser skeleton written by Richard Stallman, by
233 simplifying the original so-called "semantic" parser. */
234
235 /* All symbols defined below should begin with yy or YY, to avoid
236 infringing on user name space. This should be done even for local
237 variables, as they might otherwise be expanded by user macros.
238 There are some unavoidable exceptions within include files to
239 define necessary library symbols; they are noted "INFRINGES ON
240 USER NAME SPACE" below. */
241
242 ]b4_identification
243 b4_percent_code_get([[top]])[]dnl
244 m4_if(b4_prefix, [yy], [],
245 [[/* Substitute the variable and function names. */]b4_pull_if([[
246 #define yyparse ]b4_prefix[parse]])b4_push_if([[
247 #define yypush_parse ]b4_prefix[push_parse]b4_pull_if([[
248 #define yypull_parse ]b4_prefix[pull_parse]])[
249 #define yypstate_new ]b4_prefix[pstate_new
250 #define yypstate_delete ]b4_prefix[pstate_delete
251 #define yypstate ]b4_prefix[pstate]])[
252 #define yylex ]b4_prefix[lex
253 #define yyerror ]b4_prefix[error
254 #define yylval ]b4_prefix[lval
255 #define yychar ]b4_prefix[char
256 #define yydebug ]b4_prefix[debug
257 #define yynerrs ]b4_prefix[nerrs
258 ]b4_locations_if([[#define yylloc ]b4_prefix[lloc]])])[
259
260 /* Copy the first part of user declarations. */
261 ]b4_user_pre_prologue[
262
263 /* Enabling traces. */
264 #ifndef YYDEBUG
265 # define YYDEBUG ]b4_debug_flag[
266 #endif
267
268 /* Enabling verbose error messages. */
269 #ifdef YYERROR_VERBOSE
270 # undef YYERROR_VERBOSE
271 # define YYERROR_VERBOSE 1
272 #else
273 # define YYERROR_VERBOSE ]b4_error_verbose_flag[
274 #endif
275
276 /* Enabling the token table. */
277 #ifndef YYTOKEN_TABLE
278 # define YYTOKEN_TABLE ]b4_token_table[
279 #endif
280
281 ]b4_percent_code_get([[requires]])[]dnl
282
283 b4_token_enums_defines(b4_tokens)[
284
285 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
286 ]m4_ifdef([b4_stype],
287 [[typedef union ]b4_union_name[
288 {
289 ]b4_user_stype[
290 } YYSTYPE;
291 # define YYSTYPE_IS_TRIVIAL 1]],
292 [m4_if(b4_tag_seen_flag, 0,
293 [[typedef int YYSTYPE;
294 # define YYSTYPE_IS_TRIVIAL 1]])])[
295 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
296 # define YYSTYPE_IS_DECLARED 1
297 #endif]b4_locations_if([[
298
299 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
300 typedef struct YYLTYPE
301 {
302 int first_line;
303 int first_column;
304 int last_line;
305 int last_column;
306 } YYLTYPE;
307 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
308 # define YYLTYPE_IS_DECLARED 1
309 # define YYLTYPE_IS_TRIVIAL 1
310 #endif]])b4_push_if([[
311
312 #ifndef YYPUSH_DECLS
313 # define YYPUSH_DECLS
314 struct yypstate;
315 typedef struct yypstate yypstate;
316 enum { YYPUSH_MORE = 4 };
317
318 ]b4_pull_if([b4_c_function_decl([[yyparse]], [[int]], b4_parse_param)
319 ])b4_c_function_decl([[yypush_parse]], [[int]],
320 [[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
321 [[[int yypushed_char]], [[yypushed_char]]],
322 [[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
323 [[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
324 b4_parse_param]))
325 b4_pull_if([b4_c_function_decl([[yypull_parse]], [[int]],
326 [[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
327 b4_parse_param]))])
328 b4_c_function_decl([[yypstate_new]], [[yypstate *]], [[[void]], []])
329 b4_c_function_decl([[yypstate_delete]], [[void]],
330 [[[yypstate *yyps]], [[yyps]]])[
331 #endif]])
332
333 b4_percent_code_get([[provides]])[]dnl
334
335 [/* Copy the second part of user declarations. */
336 ]b4_user_post_prologue
337 b4_percent_code_get[]dnl
338
339 [#ifdef short
340 # undef short
341 #endif
342
343 #ifdef YYTYPE_UINT8
344 typedef YYTYPE_UINT8 yytype_uint8;
345 #else
346 typedef unsigned char yytype_uint8;
347 #endif
348
349 #ifdef YYTYPE_INT8
350 typedef YYTYPE_INT8 yytype_int8;
351 #elif ]b4_c_modern[
352 typedef signed char yytype_int8;
353 #else
354 typedef short int yytype_int8;
355 #endif
356
357 #ifdef YYTYPE_UINT16
358 typedef YYTYPE_UINT16 yytype_uint16;
359 #else
360 typedef unsigned short int yytype_uint16;
361 #endif
362
363 #ifdef YYTYPE_INT16
364 typedef YYTYPE_INT16 yytype_int16;
365 #else
366 typedef short int yytype_int16;
367 #endif
368
369 #ifndef YYSIZE_T
370 # ifdef __SIZE_TYPE__
371 # define YYSIZE_T __SIZE_TYPE__
372 # elif defined size_t
373 # define YYSIZE_T size_t
374 # elif ! defined YYSIZE_T && ]b4_c_modern[
375 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
376 # define YYSIZE_T size_t
377 # else
378 # define YYSIZE_T unsigned int
379 # endif
380 #endif
381
382 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
383
384 #ifndef YY_
385 # if defined YYENABLE_NLS && YYENABLE_NLS
386 # if ENABLE_NLS
387 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
388 # define YY_(msgid) dgettext ("bison-runtime", msgid)
389 # endif
390 # endif
391 # ifndef YY_
392 # define YY_(msgid) msgid
393 # endif
394 #endif
395
396 /* Suppress unused-variable warnings by "using" E. */
397 #if ! defined lint || defined __GNUC__
398 # define YYUSE(e) ((void) (e))
399 #else
400 # define YYUSE(e) /* empty */
401 #endif
402
403 /* Identity function, used to suppress warnings about constant conditions. */
404 #ifndef lint
405 # define YYID(n) (n)
406 #else
407 ]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
408 {
409 return yyi;
410 }
411 #endif
412
413 #if ! defined yyoverflow || YYERROR_VERBOSE
414
415 ]b4_push_if([],
416 [[/* The parser invokes alloca or malloc; define the necessary symbols. */
417
418 # ifdef YYSTACK_USE_ALLOCA
419 # if YYSTACK_USE_ALLOCA
420 # ifdef __GNUC__
421 # define YYSTACK_ALLOC __builtin_alloca
422 # elif defined __BUILTIN_VA_ARG_INCR
423 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
424 # elif defined _AIX
425 # define YYSTACK_ALLOC __alloca
426 # elif defined _MSC_VER
427 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
428 # define alloca _alloca
429 # else
430 # define YYSTACK_ALLOC alloca
431 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && ]b4_c_modern[
432 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
433 # ifndef EXIT_SUCCESS
434 # define EXIT_SUCCESS 0
435 # endif
436 # endif
437 # endif
438 # endif
439 # endif
440
441 ]])dnl
442 [# ifdef YYSTACK_ALLOC
443 /* Pacify GCC's `empty if-body' warning. */
444 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
445 # ifndef YYSTACK_ALLOC_MAXIMUM
446 /* The OS might guarantee only one guard page at the bottom of the stack,
447 and a page size can be as small as 4096 bytes. So we cannot safely
448 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
449 to allow for a few compiler-allocated temporary stack slots. */
450 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
451 # endif
452 # else
453 # define YYSTACK_ALLOC YYMALLOC
454 # define YYSTACK_FREE YYFREE
455 # ifndef YYSTACK_ALLOC_MAXIMUM
456 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
457 # endif
458 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
459 && ! ((defined YYMALLOC || defined malloc) \
460 && (defined YYFREE || defined free)))
461 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
462 # ifndef EXIT_SUCCESS
463 # define EXIT_SUCCESS 0
464 # endif
465 # endif
466 # ifndef YYMALLOC
467 # define YYMALLOC malloc
468 # if ! defined malloc && ! defined EXIT_SUCCESS && ]b4_c_modern[
469 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
470 # endif
471 # endif
472 # ifndef YYFREE
473 # define YYFREE free
474 # if ! defined free && ! defined EXIT_SUCCESS && ]b4_c_modern[
475 void free (void *); /* INFRINGES ON USER NAME SPACE */
476 # endif
477 # endif
478 # endif
479 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
480
481
482 #if (! defined yyoverflow \
483 && (! defined __cplusplus \
484 || (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
485 && ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
486
487 /* A type that is properly aligned for any stack member. */
488 union yyalloc
489 {
490 yytype_int16 yyss_alloc;
491 YYSTYPE yyvs_alloc;]b4_locations_if([
492 YYLTYPE yyls_alloc;])[
493 };
494
495 /* The size of the maximum gap between one aligned stack and the next. */
496 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
497
498 /* The size of an array large to enough to hold all stacks, each with
499 N elements. */
500 ]b4_locations_if(
501 [# define YYSTACK_BYTES(N) \
502 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
503 + 2 * YYSTACK_GAP_MAXIMUM)],
504 [# define YYSTACK_BYTES(N) \
505 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
506 + YYSTACK_GAP_MAXIMUM)])[
507
508 /* Copy COUNT objects from FROM to TO. The source and destination do
509 not overlap. */
510 # ifndef YYCOPY
511 # if defined __GNUC__ && 1 < __GNUC__
512 # define YYCOPY(To, From, Count) \
513 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
514 # else
515 # define YYCOPY(To, From, Count) \
516 do \
517 { \
518 YYSIZE_T yyi; \
519 for (yyi = 0; yyi < (Count); yyi++) \
520 (To)[yyi] = (From)[yyi]; \
521 } \
522 while (YYID (0))
523 # endif
524 # endif
525
526 /* Relocate STACK from its old location to the new one. The
527 local variables YYSIZE and YYSTACKSIZE give the old and new number of
528 elements in the stack, and YYPTR gives the new location of the
529 stack. Advance YYPTR to a properly aligned location for the next
530 stack. */
531 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
532 do \
533 { \
534 YYSIZE_T yynewbytes; \
535 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
536 Stack = &yyptr->Stack_alloc; \
537 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
538 yyptr += yynewbytes / sizeof (*yyptr); \
539 } \
540 while (YYID (0))
541
542 #endif
543
544 /* YYFINAL -- State number of the termination state. */
545 #define YYFINAL ]b4_final_state_number[
546 /* YYLAST -- Last index in YYTABLE. */
547 #define YYLAST ]b4_last[
548
549 /* YYNTOKENS -- Number of terminals. */
550 #define YYNTOKENS ]b4_tokens_number[
551 /* YYNNTS -- Number of nonterminals. */
552 #define YYNNTS ]b4_nterms_number[
553 /* YYNRULES -- Number of rules. */
554 #define YYNRULES ]b4_rules_number[
555 /* YYNRULES -- Number of states. */
556 #define YYNSTATES ]b4_states_number[
557
558 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
559 #define YYUNDEFTOK ]b4_undef_token_number[
560 #define YYMAXUTOK ]b4_user_token_number_max[
561
562 #define YYTRANSLATE(YYX) \
563 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
564
565 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
566 static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
567 {
568 ]b4_translate[
569 };
570
571 #if YYDEBUG
572 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
573 YYRHS. */
574 static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
575 {
576 ]b4_prhs[
577 };
578
579 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
580 static const ]b4_int_type_for([b4_rhs])[ yyrhs[] =
581 {
582 ]b4_rhs[
583 };
584
585 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
586 static const ]b4_int_type_for([b4_rline])[ yyrline[] =
587 {
588 ]b4_rline[
589 };
590 #endif
591
592 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
593 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
594 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
595 static const char *const yytname[] =
596 {
597 ]b4_tname[
598 };
599 #endif
600
601 # ifdef YYPRINT
602 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
603 token YYLEX-NUM. */
604 static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
605 {
606 ]b4_toknum[
607 };
608 # endif
609
610 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
611 static const ]b4_int_type_for([b4_r1])[ yyr1[] =
612 {
613 ]b4_r1[
614 };
615
616 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
617 static const ]b4_int_type_for([b4_r2])[ yyr2[] =
618 {
619 ]b4_r2[
620 };
621
622 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
623 Performed when YYTABLE doesn't specify something else to do. Zero
624 means the default is an error. */
625 static const ]b4_int_type_for([b4_defact])[ yydefact[] =
626 {
627 ]b4_defact[
628 };
629
630 /* YYDEFGOTO[NTERM-NUM]. */
631 static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] =
632 {
633 ]b4_defgoto[
634 };
635
636 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
637 STATE-NUM. */
638 #define YYPACT_NINF ]b4_pact_ninf[
639 static const ]b4_int_type_for([b4_pact])[ yypact[] =
640 {
641 ]b4_pact[
642 };
643
644 /* YYPGOTO[NTERM-NUM]. */
645 static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] =
646 {
647 ]b4_pgoto[
648 };
649
650 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
651 positive, shift that token. If negative, reduce the rule which
652 number is the opposite. If YYTABLE_NINF, syntax error. */
653 #define YYTABLE_NINF ]b4_table_ninf[
654 static const ]b4_int_type_for([b4_table])[ yytable[] =
655 {
656 ]b4_table[
657 };
658
659 #define yypact_value_is_default(yystate) \
660 ]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
661
662 #define yytable_value_is_error(yytable_value) \
663 ]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
664
665 static const ]b4_int_type_for([b4_check])[ yycheck[] =
666 {
667 ]b4_check[
668 };
669
670 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
671 symbol of state STATE-NUM. */
672 static const ]b4_int_type_for([b4_stos])[ yystos[] =
673 {
674 ]b4_stos[
675 };
676
677 #define yyerrok (yyerrstatus = 0)
678 #define yyclearin (yychar = YYEMPTY)
679 #define YYEMPTY (-2)
680 #define YYEOF 0
681
682 #define YYACCEPT goto yyacceptlab
683 #define YYABORT goto yyabortlab
684 #define YYERROR goto yyerrorlab
685
686
687 /* Like YYERROR except do call yyerror. This remains here temporarily
688 to ease the transition to the new meaning of YYERROR, for GCC.
689 Once GCC version 2 has supplanted version 1, this can go. However,
690 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
691 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
692 discussed. */
693
694 #define YYFAIL goto yyerrlab
695 #if defined YYFAIL
696 /* This is here to suppress warnings from the GCC cpp's
697 -Wunused-macros. Normally we don't worry about that warning, but
698 some users do, and we want to make it easy for users to remove
699 YYFAIL uses, which will produce warnings from Bison 2.5. */
700 #endif
701
702 #define YYRECOVERING() (!!yyerrstatus)
703
704 #define YYBACKUP(Token, Value) \
705 do \
706 if (yychar == YYEMPTY && yylen == 1) \
707 { \
708 yychar = (Token); \
709 yylval = (Value); \
710 YYPOPSTACK (1); \]b4_lac_if([[
711 YY_LAC_DISCARD ("YYBACKUP"); \]])[
712 goto yybackup; \
713 } \
714 else \
715 { \
716 yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
717 YYERROR; \
718 } \
719 while (YYID (0))
720
721
722 #define YYTERROR 1
723 #define YYERRCODE 256
724
725
726 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
727 If N is 0, then set CURRENT to the empty location which ends
728 the previous symbol: RHS[0] (always defined). */
729
730 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
731 #ifndef YYLLOC_DEFAULT
732 # define YYLLOC_DEFAULT(Current, Rhs, N) \
733 do \
734 if (YYID (N)) \
735 { \
736 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
737 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
738 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
739 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
740 } \
741 else \
742 { \
743 (Current).first_line = (Current).last_line = \
744 YYRHSLOC (Rhs, 0).last_line; \
745 (Current).first_column = (Current).last_column = \
746 YYRHSLOC (Rhs, 0).last_column; \
747 } \
748 while (YYID (0))
749 #endif]b4_locations_if([[
750
751
752 /* YY_LOCATION_PRINT -- Print the location on the stream.
753 This macro was not mandated originally: define only if we know
754 we won't break user code: when these are the locations we know. */
755
756 #ifndef YY_LOCATION_PRINT
757 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
758 # define YY_LOCATION_PRINT(File, Loc) \
759 fprintf (File, "%d.%d-%d.%d", \
760 (Loc).first_line, (Loc).first_column, \
761 (Loc).last_line, (Loc).last_column)
762 # else
763 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
764 # endif
765 #endif]], [[
766
767
768 /* This macro is provided for backward compatibility. */
769
770 #ifndef YY_LOCATION_PRINT
771 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
772 #endif]])[
773
774
775 /* YYLEX -- calling `yylex' with the right arguments. */
776
777 #ifdef YYLEX_PARAM
778 # define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
779 #else
780 # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
781 #endif
782
783 /* Enable debugging if requested. */
784 #if YYDEBUG
785
786 # ifndef YYFPRINTF
787 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
788 # define YYFPRINTF fprintf
789 # endif
790
791 # define YYDPRINTF(Args) \
792 do { \
793 if (yydebug) \
794 YYFPRINTF Args; \
795 } while (YYID (0))
796
797 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
798 do { \
799 if (yydebug) \
800 { \
801 YYFPRINTF (stderr, "%s ", Title); \
802 yy_symbol_print (stderr, \
803 Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
804 YYFPRINTF (stderr, "\n"); \
805 } \
806 } while (YYID (0))
807
808 ]b4_yy_symbol_print_generate([b4_c_function_def])[
809
810 /*------------------------------------------------------------------.
811 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
812 | TOP (included). |
813 `------------------------------------------------------------------*/
814
815 ]b4_c_function_def([yy_stack_print], [static void],
816 [[yytype_int16 *yybottom], [yybottom]],
817 [[yytype_int16 *yytop], [yytop]])[
818 {
819 YYFPRINTF (stderr, "Stack now");
820 for (; yybottom <= yytop; yybottom++)
821 {
822 int yybot = *yybottom;
823 YYFPRINTF (stderr, " %d", yybot);
824 }
825 YYFPRINTF (stderr, "\n");
826 }
827
828 # define YY_STACK_PRINT(Bottom, Top) \
829 do { \
830 if (yydebug) \
831 yy_stack_print ((Bottom), (Top)); \
832 } while (YYID (0))
833
834
835 /*------------------------------------------------.
836 | Report that the YYRULE is going to be reduced. |
837 `------------------------------------------------*/
838
839 ]b4_c_function_def([yy_reduce_print], [static void],
840 [[YYSTYPE *yyvsp], [yyvsp]],
841 b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
842 ])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
843 b4_parse_param]))[
844 {
845 int yynrhs = yyr2[yyrule];
846 int yyi;
847 unsigned long int yylno = yyrline[yyrule];
848 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
849 yyrule - 1, yylno);
850 /* The symbols being reduced. */
851 for (yyi = 0; yyi < yynrhs; yyi++)
852 {
853 YYFPRINTF (stderr, " $%d = ", yyi + 1);
854 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
855 &]b4_rhs_value(yynrhs, yyi + 1)[
856 ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
857 b4_user_args[);
858 YYFPRINTF (stderr, "\n");
859 }
860 }
861
862 # define YY_REDUCE_PRINT(Rule) \
863 do { \
864 if (yydebug) \
865 yy_reduce_print (yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
866 } while (YYID (0))
867
868 /* Nonzero means print parse trace. It is left uninitialized so that
869 multiple parsers can coexist. */
870 int yydebug;
871 #else /* !YYDEBUG */
872 # define YYDPRINTF(Args)
873 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
874 # define YY_STACK_PRINT(Bottom, Top)
875 # define YY_REDUCE_PRINT(Rule)
876 #endif /* !YYDEBUG */
877
878
879 /* YYINITDEPTH -- initial size of the parser's stacks. */
880 #ifndef YYINITDEPTH
881 # define YYINITDEPTH ]b4_stack_depth_init[
882 #endif
883
884 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
885 if the built-in stack extension method is used).
886
887 Do not make this value too large; the results are undefined if
888 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
889 evaluated with infinite-precision integer arithmetic. */
890
891 #ifndef YYMAXDEPTH
892 # define YYMAXDEPTH ]b4_stack_depth_max[
893 #endif]b4_lac_if([[
894
895 /* Establish the initial context for the current lookahead if no initial
896 context is currently established.
897
898 We define a context as a snapshot of the parser stacks. We define
899 the initial context for a lookahead as the context in which the
900 parser initially examines that lookahead in order to select a
901 syntactic action. Thus, if the lookahead eventually proves
902 syntactically unacceptable (possibly in a later context reached via a
903 series of reductions), the initial context can be used to determine
904 the exact set of tokens that would be syntactically acceptable in the
905 lookahead's place. Moreover, it is the context after which any
906 further semantic actions would be erroneous because they would be
907 determined by a syntactically unacceptable token.
908
909 YY_LAC_ESTABLISH should be invoked when a reduction is about to be
910 performed in an inconsistent state (which, for the purposes of LAC,
911 includes consistent states that don't know they're consistent because
912 their default reductions have been disabled). Iff there is a
913 lookahead token, it should also be invoked before reporting a syntax
914 error. This latter case is for the sake of the debugging output.
915
916 For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as
917 follows. If no initial context is currently established for the
918 current lookahead, then check if that lookahead can eventually be
919 shifted if syntactic actions continue from the current context.
920 Report a syntax error if it cannot. */
921 #define YY_LAC_ESTABLISH \
922 do { \
923 if (!yy_lac_established) \
924 { \
925 YYDPRINTF ((stderr, \
926 "LAC: initial context established for %s\n", \
927 yytname[yytoken])); \
928 yy_lac_established = 1; \
929 { \
930 int yy_lac_status = \
931 yy_lac (yyssp, yytoken); \
932 if (yy_lac_status == 2) \
933 goto yyexhaustedlab; \
934 if (yy_lac_status == 1) \
935 goto yyerrlab; \
936 } \
937 } \
938 } while (YYID (0))
939
940 /* Discard any previous initial lookahead context because of Event,
941 which may be a lookahead change or an invalidation of the currently
942 established initial context for the current lookahead.
943
944 The most common example of a lookahead change is a shift. An example
945 of both cases is syntax error recovery. That is, a syntax error
946 occurs when the lookahead is syntactically erroneous for the
947 currently established initial context, so error recovery manipulates
948 the parser stacks to try to find a new initial context in which the
949 current lookahead is syntactically acceptable. If it fails to find
950 such a context, it discards the lookahead. */
951 #if YYDEBUG
952 # define YY_LAC_DISCARD(Event) \
953 do { \
954 if (yy_lac_established) \
955 { \
956 if (yydebug) \
957 YYFPRINTF (stderr, "LAC: initial context discarded due to " \
958 Event "\n"); \
959 yy_lac_established = 0; \
960 } \
961 } while (YYID (0))
962 #else
963 # define YY_LAC_DISCARD(Event) yy_lac_established = 0
964 #endif
965
966 /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
967 eventually (after perhaps some reductions) be shifted, and return 1
968 if not. Return 2 if memory is exhausted. */
969 static int
970 yy_lac (yytype_int16 *yyssp, int yytoken)
971 {
972 yytype_int16 *yyes_prev = yyssp;
973 yytype_int16 yyes@{]b4_percent_define_get([[parse.lac.es-capacity]])[@};
974 yytype_int16 *yyesp = yyes_prev;
975 YYDPRINTF ((stderr, "LAC: checking lookahead %s:", yytname[yytoken]));
976 if (yytoken == YYUNDEFTOK)
977 {
978 YYDPRINTF ((stderr, " Always Err\n"));
979 return 1;
980 }
981 while (1)
982 {
983 int yyrule = yypact[*yyesp];
984 if (yypact_value_is_default (yyrule)
985 || (yyrule += yytoken) < 0 || YYLAST < yyrule
986 || yycheck[yyrule] != yytoken)
987 {
988 yyrule = yydefact[*yyesp];
989 if (yyrule == 0)
990 {
991 YYDPRINTF ((stderr, " Err\n"));
992 return 1;
993 }
994 }
995 else
996 {
997 yyrule = yytable[yyrule];
998 if (yytable_value_is_error (yyrule))
999 {
1000 YYDPRINTF ((stderr, " Err\n"));
1001 return 1;
1002 }
1003 if (0 < yyrule)
1004 {
1005 YYDPRINTF ((stderr, " S%d\n", yyrule));
1006 return 0;
1007 }
1008 yyrule = -yyrule;
1009 }
1010 {
1011 YYSIZE_T yylen = yyr2[yyrule];
1012 YYDPRINTF ((stderr, " R%d", yyrule - 1));
1013 if (yyesp != yyes_prev)
1014 {
1015 YYSIZE_T yysize = yyesp - yyes + 1;
1016 if (yylen < yysize)
1017 {
1018 yyesp -= yylen;
1019 yylen = 0;
1020 }
1021 else
1022 {
1023 yylen -= yysize;
1024 yyesp = yyes_prev;
1025 }
1026 }
1027 if (yylen)
1028 yyesp = yyes_prev -= yylen;
1029 }
1030 {
1031 int yystate;
1032 {
1033 int yylhs = yyr1[yyrule] - YYNTOKENS;
1034 yystate = yypgoto[yylhs] + *yyesp;
1035 if (yystate < 0 || YYLAST < yystate
1036 || yycheck[yystate] != *yyesp)
1037 yystate = yydefgoto[yylhs];
1038 else
1039 yystate = yytable[yystate];
1040 }
1041 if (yyesp == yyes_prev)
1042 {
1043 yyesp = yyes;
1044 *yyesp = yystate;
1045 }
1046 else
1047 {
1048 if (yyesp == yyes + (sizeof yyes / sizeof *yyes) - 1)
1049 {
1050 YYDPRINTF ((stderr, " (max stack size exceeded)\n"));
1051 return 2;
1052 }
1053 *++yyesp = yystate;
1054 }
1055 YYDPRINTF ((stderr, " G%d", *yyesp));
1056 }
1057 }
1058 }]])[
1059
1060
1061 #if YYERROR_VERBOSE
1062
1063 # ifndef yystrlen
1064 # if defined __GLIBC__ && defined _STRING_H
1065 # define yystrlen strlen
1066 # else
1067 /* Return the length of YYSTR. */
1068 ]b4_c_function_def([yystrlen], [static YYSIZE_T],
1069 [[const char *yystr], [yystr]])[
1070 {
1071 YYSIZE_T yylen;
1072 for (yylen = 0; yystr[yylen]; yylen++)
1073 continue;
1074 return yylen;
1075 }
1076 # endif
1077 # endif
1078
1079 # ifndef yystpcpy
1080 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1081 # define yystpcpy stpcpy
1082 # else
1083 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1084 YYDEST. */
1085 ]b4_c_function_def([yystpcpy], [static char *],
1086 [[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[
1087 {
1088 char *yyd = yydest;
1089 const char *yys = yysrc;
1090
1091 while ((*yyd++ = *yys++) != '\0')
1092 continue;
1093
1094 return yyd - 1;
1095 }
1096 # endif
1097 # endif
1098
1099 # ifndef yytnamerr
1100 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1101 quotes and backslashes, so that it's suitable for yyerror. The
1102 heuristic is that double-quoting is unnecessary unless the string
1103 contains an apostrophe, a comma, or backslash (other than
1104 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1105 null, do not copy; instead, return the length of what the result
1106 would have been. */
1107 static YYSIZE_T
1108 yytnamerr (char *yyres, const char *yystr)
1109 {
1110 if (*yystr == '"')
1111 {
1112 YYSIZE_T yyn = 0;
1113 char const *yyp = yystr;
1114
1115 for (;;)
1116 switch (*++yyp)
1117 {
1118 case '\'':
1119 case ',':
1120 goto do_not_strip_quotes;
1121
1122 case '\\':
1123 if (*++yyp != '\\')
1124 goto do_not_strip_quotes;
1125 /* Fall through. */
1126 default:
1127 if (yyres)
1128 yyres[yyn] = *yyp;
1129 yyn++;
1130 break;
1131
1132 case '"':
1133 if (yyres)
1134 yyres[yyn] = '\0';
1135 return yyn;
1136 }
1137 do_not_strip_quotes: ;
1138 }
1139
1140 if (! yyres)
1141 return yystrlen (yystr);
1142
1143 return yystpcpy (yyres, yystr) - yyres;
1144 }
1145 # endif
1146
1147 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1148 about the unexpected token YYTOKEN for the state stack whose top is
1149 YYSSP.]b4_lac_if([[ In order to see if a particular token T is a
1150 valid looakhead, invoke yy_lac (YYSSP, T).]])[
1151
1152 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1153 not large enough to hold the message. In that case, also set
1154 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1155 required number of bytes is too large to store]b4_lac_if([[ or if
1156 yy_lac returned 2]])[. */
1157 static int
1158 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1159 yytype_int16 *yyssp, int yytoken)
1160 {
1161 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1162 YYSIZE_T yysize = yysize0;
1163 YYSIZE_T yysize1;
1164 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1165 /* Internationalized format string. */
1166 const char *yyformat = 0;
1167 /* Arguments of yyformat. */
1168 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1169 /* Number of reported tokens (one for the "unexpected", one per
1170 "expected"). */
1171 int yycount = 0;
1172
1173 /* There are many possibilities here to consider:
1174 - Assume YYFAIL is not used. It's too flawed to consider. See
1175 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1176 for details. YYERROR is fine as it does not invoke this
1177 function.
1178 - If this state is a consistent state with a default action, then
1179 the only way this function was invoked is if the default action
1180 is an error action. In that case, don't check for expected
1181 tokens because there are none.
1182 - The only way there can be no lookahead present (in yychar) is if
1183 this state is a consistent state with a default action. Thus,
1184 detecting the absence of a lookahead is sufficient to determine
1185 that there is no unexpected or expected token to report. In that
1186 case, just report a simple "syntax error".
1187 - Don't assume there isn't a lookahead just because this state is a
1188 consistent state with a default action. There might have been a
1189 previous inconsistent state, consistent state with a non-default
1190 action, or user semantic action that manipulated yychar.]b4_lac_if([[
1191 In the first two cases, it might appear that the current syntax
1192 error should have been detected in the previous state when yy_lac
1193 was invoked. However, at that time, there might have been a
1194 different syntax error that discarded a different initial context
1195 during error recovery, leaving behind the current lookahead.]], [[
1196 - Of course, the expected token list depends on states to have
1197 correct lookahead information, and it depends on the parser not
1198 to perform extra reductions after fetching a lookahead from the
1199 scanner and before detecting a syntax error. Thus, state merging
1200 (from LALR or IELR) and default reductions corrupt the expected
1201 token list. However, the list is correct for canonical LR with
1202 one exception: it will still contain any token that will not be
1203 accepted due to an error action in a later state.]])[
1204 */
1205 if (yytoken != YYEMPTY)
1206 {
1207 int yyn = yypact[*yyssp];]b4_lac_if([[
1208 YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
1209 yyarg[yycount++] = yytname[yytoken];
1210 if (!yypact_value_is_default (yyn))
1211 {]b4_lac_if([], [[
1212 /* Start YYX at -YYN if negative to avoid negative indexes in
1213 YYCHECK. In other words, skip the first -YYN actions for
1214 this state because they are default actions. */
1215 int yyxbegin = yyn < 0 ? -yyn : 0;
1216 /* Stay within bounds of both yycheck and yytname. */
1217 int yychecklim = YYLAST - yyn + 1;
1218 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;]])[
1219 int yyx;]b4_lac_if([[
1220
1221 for (yyx = 0; yyx < YYNTOKENS; ++yyx)
1222 if (yyx != YYTERROR && yyx != YYUNDEFTOK)
1223 {
1224 {
1225 int yy_lac_status = yy_lac (yyssp, yyx);
1226 if (yy_lac_status == 2)
1227 return 2;
1228 if (yy_lac_status == 1)
1229 continue;
1230 }]], [[
1231
1232 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1233 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1234 && !yytable_value_is_error (yytable[yyx + yyn]))
1235 {]])[
1236 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1237 {
1238 yycount = 1;
1239 yysize = yysize0;
1240 break;
1241 }
1242 yyarg[yycount++] = yytname[yyx];
1243 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1244 if (! (yysize <= yysize1
1245 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1246 return 2;
1247 yysize = yysize1;
1248 }
1249 }]b4_lac_if([[
1250 # if YYDEBUG
1251 else if (yydebug)
1252 YYFPRINTF (stderr, "No expected tokens.\n");
1253 # endif]])[
1254 }
1255
1256 switch (yycount)
1257 {
1258 # define YYCASE_(N, S) \
1259 case N: \
1260 yyformat = S; \
1261 break
1262 YYCASE_(0, YY_("syntax error"));
1263 YYCASE_(1, YY_("syntax error, unexpected %s"));
1264 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1265 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1266 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1267 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1268 # undef YYCASE_
1269 }
1270
1271 yysize1 = yysize + yystrlen (yyformat);
1272 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1273 return 2;
1274 yysize = yysize1;
1275
1276 if (*yymsg_alloc < yysize)
1277 {
1278 *yymsg_alloc = 2 * yysize;
1279 if (! (yysize <= *yymsg_alloc
1280 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1281 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1282 return 1;
1283 }
1284
1285 /* Avoid sprintf, as that infringes on the user's name space.
1286 Don't have undefined behavior even if the translation
1287 produced a string with the wrong number of "%s"s. */
1288 {
1289 char *yyp = *yymsg;
1290 int yyi = 0;
1291 while ((*yyp = *yyformat) != '\0')
1292 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1293 {
1294 yyp += yytnamerr (yyp, yyarg[yyi++]);
1295 yyformat += 2;
1296 }
1297 else
1298 {
1299 yyp++;
1300 yyformat++;
1301 }
1302 }
1303 return 0;
1304 }
1305 #endif /* YYERROR_VERBOSE */
1306
1307 ]b4_yydestruct_generate([b4_c_function_def])b4_push_if([], [[
1308
1309
1310 /* Prevent warnings from -Wmissing-prototypes. */
1311 #ifdef YYPARSE_PARAM
1312 ]b4_c_function_decl([yyparse], [int],
1313 [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
1314 #else /* ! YYPARSE_PARAM */
1315 ]b4_c_function_decl([yyparse], [int], b4_parse_param)[
1316 #endif /* ! YYPARSE_PARAM */]])b4_pure_if([], [
1317
1318 b4_declare_scanner_communication_variables])[]b4_push_if([[
1319
1320
1321 struct yypstate
1322 {]b4_declare_parser_state_variables[
1323 /* Used to determine if this is the first time this instance has
1324 been used. */
1325 int yynew;
1326 };]b4_pure_if([], [[
1327
1328 static char yypstate_allocated = 0;]])b4_pull_if([
1329
1330 b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
1331 {
1332 return yypull_parse (0]m4_ifset([b4_parse_param],
1333 [[, ]b4_c_args(b4_parse_param)])[);
1334 }
1335
1336 ]b4_c_function_def([[yypull_parse]], [[int]],
1337 [[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
1338 b4_parse_param]))[
1339 {
1340 int yystatus;
1341 yypstate *yyps_local;]b4_pure_if([[
1342 int yychar;
1343 YYSTYPE yylval;]b4_locations_if([[
1344 YYLTYPE yylloc;]])])[
1345 if (yyps == 0)
1346 {
1347 yyps_local = yypstate_new ();
1348 if (!yyps_local)
1349 {]b4_pure_if([[
1350 yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[
1351 if (!yypstate_allocated)
1352 yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[
1353 return 2;
1354 }
1355 }
1356 else
1357 yyps_local = yyps;
1358 do {
1359 yychar = YYLEX;
1360 yystatus =
1361 yypush_parse (yyps_local]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])[);
1362 } while (yystatus == YYPUSH_MORE);
1363 if (yyps == 0)
1364 yypstate_delete (yyps_local);
1365 return yystatus;
1366 }]])[
1367
1368 /* Initialize the parser data structure. */
1369 ]b4_c_function_def([[yypstate_new]], [[yypstate *]])[
1370 {
1371 yypstate *yyps;]b4_pure_if([], [[
1372 if (yypstate_allocated)
1373 return 0;]])[
1374 yyps = (yypstate *) malloc (sizeof *yyps);
1375 if (!yyps)
1376 return 0;
1377 yyps->yynew = 1;]b4_pure_if([], [[
1378 yypstate_allocated = 1;]])[
1379 return yyps;
1380 }
1381
1382 ]b4_c_function_def([[yypstate_delete]], [[void]],
1383 [[[yypstate *yyps]], [[yyps]]])[
1384 {
1385 #ifndef yyoverflow
1386 /* If the stack was reallocated but the parse did not complete, then the
1387 stack still needs to be freed. */
1388 if (!yyps->yynew && yyps->yyss != yyps->yyssa)
1389 YYSTACK_FREE (yyps->yyss);
1390 #endif
1391 free (yyps);]b4_pure_if([], [[
1392 yypstate_allocated = 0;]])[
1393 }
1394 ]b4_pure_if([[
1395 #define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
1396 #define yystate yyps->yystate
1397 #define yyerrstatus yyps->yyerrstatus
1398 #define yyssa yyps->yyssa
1399 #define yyss yyps->yyss
1400 #define yyssp yyps->yyssp
1401 #define yyvsa yyps->yyvsa
1402 #define yyvs yyps->yyvs
1403 #define yyvsp yyps->yyvsp]b4_locations_if([[
1404 #define yylsa yyps->yylsa
1405 #define yyls yyps->yyls
1406 #define yylsp yyps->yylsp
1407 #define yyerror_range yyps->yyerror_range]])[
1408 #define yystacksize yyps->yystacksize
1409
1410
1411 /*---------------.
1412 | yypush_parse. |
1413 `---------------*/
1414
1415 ]b4_c_function_def([[yypush_parse]], [[int]],
1416 [[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
1417 [[[int yypushed_char]], [[yypushed_char]]],
1418 [[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
1419 [[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
1420 b4_parse_param]))], [[
1421
1422
1423 /*----------.
1424 | yyparse. |
1425 `----------*/
1426
1427 #ifdef YYPARSE_PARAM
1428 ]b4_c_function_def([yyparse], [int],
1429 [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
1430 #else /* ! YYPARSE_PARAM */
1431 ]b4_c_function_def([yyparse], [int], b4_parse_param)[
1432 #endif]])[
1433 {]b4_pure_if([b4_declare_scanner_communication_variables
1434 ])b4_push_if([b4_pure_if([], [[
1435 int yypushed_char = yychar;
1436 YYSTYPE yypushed_val = yylval;]b4_locations_if([[
1437 YYLTYPE yypushed_loc = yylloc;]])
1438 ])],
1439 [b4_declare_parser_state_variables
1440 ])b4_lac_if([[
1441 int yy_lac_established = 0;]])[
1442 int yyn;
1443 int yyresult;
1444 /* Lookahead token as an internal (translated) token number. */
1445 int yytoken;
1446 /* The variables used to return semantic value and location from the
1447 action routines. */
1448 YYSTYPE yyval;]b4_locations_if([[
1449 YYLTYPE yyloc;]])[
1450
1451 #if YYERROR_VERBOSE
1452 /* Buffer for error messages, and its allocated size. */
1453 char yymsgbuf[128];
1454 char *yymsg = yymsgbuf;
1455 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1456 #endif
1457
1458 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[)
1459
1460 /* The number of symbols on the RHS of the reduced rule.
1461 Keep to zero when no symbol should be popped. */
1462 int yylen = 0;]b4_push_if([[
1463
1464 if (!yyps->yynew)
1465 {
1466 yyn = yypact[yystate];
1467 goto yyread_pushed_token;
1468 }]])[
1469
1470 yytoken = 0;
1471 yyss = yyssa;
1472 yyvs = yyvsa;]b4_locations_if([[
1473 yyls = yylsa;]])[
1474 yystacksize = YYINITDEPTH;
1475
1476 YYDPRINTF ((stderr, "Starting parse\n"));
1477
1478 yystate = 0;
1479 yyerrstatus = 0;
1480 yynerrs = 0;
1481 yychar = YYEMPTY; /* Cause a token to be read. */
1482
1483 /* Initialize stack pointers.
1484 Waste one element of value and location stack
1485 so that they stay on the same level as the state stack.
1486 The wasted elements are never initialized. */
1487 yyssp = yyss;
1488 yyvsp = yyvs;]b4_locations_if([[
1489 yylsp = yyls;
1490
1491 #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1492 /* Initialize the default location before parsing starts. */
1493 yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
1494 yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
1495 #endif]])
1496 m4_ifdef([b4_initial_action],[
1497 m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl
1498 m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl
1499 /* User initialization code. */
1500 b4_user_initial_action
1501 m4_popdef([b4_dollar_dollar])dnl
1502 m4_popdef([b4_at_dollar])])dnl
1503 m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
1504 ]])dnl
1505 m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
1506 ]])[
1507 goto yysetstate;
1508
1509 /*------------------------------------------------------------.
1510 | yynewstate -- Push a new state, which is found in yystate. |
1511 `------------------------------------------------------------*/
1512 yynewstate:
1513 /* In all cases, when you get here, the value and location stacks
1514 have just been pushed. So pushing a state here evens the stacks. */
1515 yyssp++;
1516
1517 yysetstate:
1518 *yyssp = yystate;
1519
1520 if (yyss + yystacksize - 1 <= yyssp)
1521 {
1522 /* Get the current used size of the three stacks, in elements. */
1523 YYSIZE_T yysize = yyssp - yyss + 1;
1524
1525 #ifdef yyoverflow
1526 {
1527 /* Give user a chance to reallocate the stack. Use copies of
1528 these so that the &'s don't force the real ones into
1529 memory. */
1530 YYSTYPE *yyvs1 = yyvs;
1531 yytype_int16 *yyss1 = yyss;]b4_locations_if([
1532 YYLTYPE *yyls1 = yyls;])[
1533
1534 /* Each stack pointer address is followed by the size of the
1535 data in use in that stack, in bytes. This used to be a
1536 conditional around just the two extra args, but that might
1537 be undefined if yyoverflow is a macro. */
1538 yyoverflow (YY_("memory exhausted"),
1539 &yyss1, yysize * sizeof (*yyssp),
1540 &yyvs1, yysize * sizeof (*yyvsp),]b4_locations_if([
1541 &yyls1, yysize * sizeof (*yylsp),])[
1542 &yystacksize);
1543 ]b4_locations_if([
1544 yyls = yyls1;])[
1545 yyss = yyss1;
1546 yyvs = yyvs1;
1547 }
1548 #else /* no yyoverflow */
1549 # ifndef YYSTACK_RELOCATE
1550 goto yyexhaustedlab;
1551 # else
1552 /* Extend the stack our own way. */
1553 if (YYMAXDEPTH <= yystacksize)
1554 goto yyexhaustedlab;
1555 yystacksize *= 2;
1556 if (YYMAXDEPTH < yystacksize)
1557 yystacksize = YYMAXDEPTH;
1558
1559 {
1560 yytype_int16 *yyss1 = yyss;
1561 union yyalloc *yyptr =
1562 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1563 if (! yyptr)
1564 goto yyexhaustedlab;
1565 YYSTACK_RELOCATE (yyss_alloc, yyss);
1566 YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
1567 YYSTACK_RELOCATE (yyls_alloc, yyls);])[
1568 # undef YYSTACK_RELOCATE
1569 if (yyss1 != yyssa)
1570 YYSTACK_FREE (yyss1);
1571 }
1572 # endif
1573 #endif /* no yyoverflow */
1574
1575 yyssp = yyss + yysize - 1;
1576 yyvsp = yyvs + yysize - 1;]b4_locations_if([
1577 yylsp = yyls + yysize - 1;])[
1578
1579 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1580 (unsigned long int) yystacksize));
1581
1582 if (yyss + yystacksize - 1 <= yyssp)
1583 YYABORT;
1584 }
1585
1586 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1587
1588 if (yystate == YYFINAL)
1589 YYACCEPT;
1590
1591 goto yybackup;
1592
1593 /*-----------.
1594 | yybackup. |
1595 `-----------*/
1596 yybackup:
1597
1598 /* Do appropriate processing given the current state. Read a
1599 lookahead token if we need one and don't already have one. */
1600
1601 /* First try to decide what to do without reference to lookahead token. */
1602 yyn = yypact[yystate];
1603 if (yypact_value_is_default (yyn))
1604 goto yydefault;
1605
1606 /* Not known => get a lookahead token if don't already have one. */
1607
1608 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1609 if (yychar == YYEMPTY)
1610 {]b4_push_if([[
1611 if (!yyps->yynew)
1612 {]b4_use_push_for_pull_if([], [[
1613 YYDPRINTF ((stderr, "Return for a new token:\n"));]])[
1614 yyresult = YYPUSH_MORE;
1615 goto yypushreturn;
1616 }
1617 yyps->yynew = 0;]b4_pure_if([], [[
1618 /* Restoring the pushed token is only necessary for the first
1619 yypush_parse invocation since subsequent invocations don't overwrite
1620 it before jumping to yyread_pushed_token. */
1621 yychar = yypushed_char;
1622 yylval = yypushed_val;]b4_locations_if([[
1623 yylloc = yypushed_loc;]])])[
1624 yyread_pushed_token:]])[
1625 YYDPRINTF ((stderr, "Reading a token: "));]b4_push_if([b4_pure_if([[
1626 yychar = yypushed_char;
1627 if (yypushed_val)
1628 yylval = *yypushed_val;]b4_locations_if([[
1629 if (yypushed_loc)
1630 yylloc = *yypushed_loc;]])])], [[
1631 yychar = YYLEX;]])[
1632 }
1633
1634 if (yychar <= YYEOF)
1635 {
1636 yychar = yytoken = YYEOF;
1637 YYDPRINTF ((stderr, "Now at end of input.\n"));
1638 }
1639 else
1640 {
1641 yytoken = YYTRANSLATE (yychar);
1642 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1643 }
1644
1645 /* If the proper action on seeing token YYTOKEN is to reduce or to
1646 detect an error, take that action. */
1647 yyn += yytoken;
1648 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)]b4_lac_if([[
1649 {
1650 YY_LAC_ESTABLISH;
1651 goto yydefault;
1652 }]], [[
1653 goto yydefault;]])[
1654 yyn = yytable[yyn];
1655 if (yyn <= 0)
1656 {
1657 if (yytable_value_is_error (yyn))
1658 goto yyerrlab;]b4_lac_if([[
1659 YY_LAC_ESTABLISH;]])[
1660 yyn = -yyn;
1661 goto yyreduce;
1662 }
1663
1664 /* Count tokens shifted since error; after three, turn off error
1665 status. */
1666 if (yyerrstatus)
1667 yyerrstatus--;
1668
1669 /* Shift the lookahead token. */
1670 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1671
1672 /* Discard the shifted token. */
1673 yychar = YYEMPTY;]b4_lac_if([[
1674 YY_LAC_DISCARD ("shift");]])[
1675
1676 yystate = yyn;
1677 *++yyvsp = yylval;
1678 ]b4_locations_if([ *++yylsp = yylloc;])[
1679 goto yynewstate;
1680
1681
1682 /*-----------------------------------------------------------.
1683 | yydefault -- do the default action for the current state. |
1684 `-----------------------------------------------------------*/
1685 yydefault:
1686 yyn = yydefact[yystate];
1687 if (yyn == 0)
1688 goto yyerrlab;
1689 goto yyreduce;
1690
1691
1692 /*-----------------------------.
1693 | yyreduce -- Do a reduction. |
1694 `-----------------------------*/
1695 yyreduce:
1696 /* yyn is the number of a rule to reduce with. */
1697 yylen = yyr2[yyn];
1698
1699 /* If YYLEN is nonzero, implement the default value of the action:
1700 `$$ = $1'.
1701
1702 Otherwise, the following line sets YYVAL to garbage.
1703 This behavior is undocumented and Bison
1704 users should not rely upon it. Assigning to YYVAL
1705 unconditionally makes the parser a bit smaller, and it avoids a
1706 GCC warning that YYVAL may be used uninitialized. */
1707 yyval = yyvsp[1-yylen];
1708
1709 ]b4_locations_if(
1710 [[ /* Default location. */
1711 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
1712 YY_REDUCE_PRINT (yyn);]b4_lac_if([[
1713 {
1714 int yychar_backup = yychar;
1715 switch (yyn)
1716 {
1717 ]b4_user_actions[
1718 default: break;
1719 }
1720 if (yychar_backup != yychar)
1721 YY_LAC_DISCARD ("yychar change");
1722 }]], [[
1723 switch (yyn)
1724 {
1725 ]b4_user_actions[
1726 default: break;
1727 }]])[
1728 /* User semantic actions sometimes alter yychar, and that requires
1729 that yytoken be updated with the new translation. We take the
1730 approach of translating immediately before every use of yytoken.
1731 One alternative is translating here after every semantic action,
1732 but that translation would be missed if the semantic action invokes
1733 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1734 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1735 incorrect destructor might then be invoked immediately. In the
1736 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1737 to an incorrect destructor call or verbose syntax error message
1738 before the lookahead is translated. */
1739 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1740
1741 YYPOPSTACK (yylen);
1742 yylen = 0;
1743 YY_STACK_PRINT (yyss, yyssp);
1744
1745 *++yyvsp = yyval;]b4_locations_if([
1746 *++yylsp = yyloc;])[
1747
1748 /* Now `shift' the result of the reduction. Determine what state
1749 that goes to, based on the state we popped back to and the rule
1750 number reduced by. */
1751
1752 yyn = yyr1[yyn];
1753
1754 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1755 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1756 yystate = yytable[yystate];
1757 else
1758 yystate = yydefgoto[yyn - YYNTOKENS];
1759
1760 goto yynewstate;
1761
1762
1763 /*------------------------------------.
1764 | yyerrlab -- here on detecting error |
1765 `------------------------------------*/
1766 yyerrlab:
1767 /* Make sure we have latest lookahead translation. See comments at
1768 user semantic actions for why this is necessary. */
1769 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1770
1771 /* If not already recovering from an error, report this error. */
1772 if (!yyerrstatus)
1773 {
1774 ++yynerrs;
1775 #if ! YYERROR_VERBOSE
1776 yyerror (]b4_yyerror_args[YY_("syntax error"));
1777 #else
1778 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, yyssp, \
1779 yytoken)
1780 {
1781 char const *yymsgp = YY_("syntax error");
1782 int yysyntax_error_status;]b4_lac_if([[
1783 if (yychar != YYEMPTY)
1784 YY_LAC_ESTABLISH;]])[
1785 yysyntax_error_status = YYSYNTAX_ERROR;
1786 if (yysyntax_error_status == 0)
1787 yymsgp = yymsg;
1788 else if (yysyntax_error_status == 1)
1789 {
1790 if (yymsg != yymsgbuf)
1791 YYSTACK_FREE (yymsg);
1792 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1793 if (!yymsg)
1794 {
1795 yymsg = yymsgbuf;
1796 yymsg_alloc = sizeof yymsgbuf;
1797 yysyntax_error_status = 2;
1798 }
1799 else
1800 {
1801 yysyntax_error_status = YYSYNTAX_ERROR;
1802 yymsgp = yymsg;
1803 }
1804 }
1805 yyerror (]b4_yyerror_args[yymsgp);
1806 if (yysyntax_error_status == 2)
1807 goto yyexhaustedlab;
1808 }
1809 # undef YYSYNTAX_ERROR
1810 #endif
1811 }
1812
1813 ]b4_locations_if([[ yyerror_range[1] = yylloc;]])[
1814
1815 if (yyerrstatus == 3)
1816 {
1817 /* If just tried and failed to reuse lookahead token after an
1818 error, discard it. */
1819
1820 if (yychar <= YYEOF)
1821 {
1822 /* Return failure if at end of input. */
1823 if (yychar == YYEOF)
1824 YYABORT;
1825 }
1826 else
1827 {
1828 yydestruct ("Error: discarding",
1829 yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
1830 yychar = YYEMPTY;
1831 }
1832 }
1833
1834 /* Else will try to reuse lookahead token after shifting the error
1835 token. */
1836 goto yyerrlab1;
1837
1838
1839 /*---------------------------------------------------.
1840 | yyerrorlab -- error raised explicitly by YYERROR. |
1841 `---------------------------------------------------*/
1842 yyerrorlab:
1843
1844 /* Pacify compilers like GCC when the user code never invokes
1845 YYERROR and the label yyerrorlab therefore never appears in user
1846 code. */
1847 if (/*CONSTCOND*/ 0)
1848 goto yyerrorlab;
1849
1850 ]b4_locations_if([[ yyerror_range[1] = yylsp[1-yylen];
1851 ]])[ /* Do not reclaim the symbols of the rule which action triggered
1852 this YYERROR. */
1853 YYPOPSTACK (yylen);
1854 yylen = 0;
1855 YY_STACK_PRINT (yyss, yyssp);
1856 yystate = *yyssp;
1857 goto yyerrlab1;
1858
1859
1860 /*-------------------------------------------------------------.
1861 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1862 `-------------------------------------------------------------*/
1863 yyerrlab1:
1864 yyerrstatus = 3; /* Each real token shifted decrements this. */
1865
1866 for (;;)
1867 {
1868 yyn = yypact[yystate];
1869 if (!yypact_value_is_default (yyn))
1870 {
1871 yyn += YYTERROR;
1872 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1873 {
1874 yyn = yytable[yyn];
1875 if (0 < yyn)
1876 break;
1877 }
1878 }
1879
1880 /* Pop the current state because it cannot handle the error token. */
1881 if (yyssp == yyss)
1882 YYABORT;
1883
1884 ]b4_locations_if([[ yyerror_range[1] = *yylsp;]])[
1885 yydestruct ("Error: popping",
1886 yystos[yystate], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
1887 YYPOPSTACK (1);
1888 yystate = *yyssp;
1889 YY_STACK_PRINT (yyss, yyssp);
1890 }]b4_lac_if([[
1891
1892 /* If the stack popping above didn't lose the initial context for the
1893 current lookahead token, the shift below will for sure. */
1894 YY_LAC_DISCARD ("error recovery");]])[
1895
1896 *++yyvsp = yylval;
1897 ]b4_locations_if([[
1898 yyerror_range[2] = yylloc;
1899 /* Using YYLLOC is tempting, but would change the location of
1900 the lookahead. YYLOC is available though. */
1901 YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
1902 *++yylsp = yyloc;]])[
1903
1904 /* Shift the error token. */
1905 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1906
1907 yystate = yyn;
1908 goto yynewstate;
1909
1910
1911 /*-------------------------------------.
1912 | yyacceptlab -- YYACCEPT comes here. |
1913 `-------------------------------------*/
1914 yyacceptlab:
1915 yyresult = 0;
1916 goto yyreturn;
1917
1918 /*-----------------------------------.
1919 | yyabortlab -- YYABORT comes here. |
1920 `-----------------------------------*/
1921 yyabortlab:
1922 yyresult = 1;
1923 goto yyreturn;
1924
1925 #if ]b4_lac_if([[1]], [[!defined(yyoverflow) || YYERROR_VERBOSE]])[
1926 /*-------------------------------------------------.
1927 | yyexhaustedlab -- memory exhaustion comes here. |
1928 `-------------------------------------------------*/
1929 yyexhaustedlab:
1930 yyerror (]b4_yyerror_args[YY_("memory exhausted"));
1931 yyresult = 2;
1932 /* Fall through. */
1933 #endif
1934
1935 yyreturn:
1936 if (yychar != YYEMPTY)
1937 {
1938 /* Make sure we have latest lookahead translation. See comments at
1939 user semantic actions for why this is necessary. */
1940 yytoken = YYTRANSLATE (yychar);
1941 yydestruct ("Cleanup: discarding lookahead",
1942 yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
1943 }
1944 /* Do not reclaim the symbols of the rule which action triggered
1945 this YYABORT or YYACCEPT. */
1946 YYPOPSTACK (yylen);
1947 YY_STACK_PRINT (yyss, yyssp);
1948 while (yyssp != yyss)
1949 {
1950 yydestruct ("Cleanup: popping",
1951 yystos[*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
1952 YYPOPSTACK (1);
1953 }
1954 #ifndef yyoverflow
1955 if (yyss != yyssa)
1956 YYSTACK_FREE (yyss);
1957 #endif]b4_push_if([[
1958 yyps->yynew = 1;
1959
1960 yypushreturn:]])[
1961 #if YYERROR_VERBOSE
1962 if (yymsg != yymsgbuf)
1963 YYSTACK_FREE (yymsg);
1964 #endif
1965 /* Make sure YYID is used. */
1966 return YYID (yyresult);
1967 }
1968
1969
1970 ]b4_epilogue
1971 b4_defines_if(
1972 [@output(b4_spec_defines_file@)@
1973 b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],
1974 [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010])
1975
1976 b4_percent_code_get([[requires]])[]dnl
1977
1978 b4_token_enums_defines(b4_tokens)
1979
1980 [#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1981 ]m4_ifdef([b4_stype],
1982 [[typedef union ]b4_union_name[
1983 {
1984 ]b4_user_stype[
1985 } YYSTYPE;
1986 # define YYSTYPE_IS_TRIVIAL 1]],
1987 [m4_if(b4_tag_seen_flag, 0,
1988 [[typedef int YYSTYPE;
1989 # define YYSTYPE_IS_TRIVIAL 1]])])[
1990 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1991 # define YYSTYPE_IS_DECLARED 1
1992 #endif
1993
1994 ]b4_pure_if([], [[extern YYSTYPE ]b4_prefix[lval;]])
1995
1996 b4_locations_if(
1997 [#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
1998 typedef struct YYLTYPE
1999 {
2000 int first_line;
2001 int first_column;
2002 int last_line;
2003 int last_column;
2004 } YYLTYPE;
2005 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
2006 # define YYLTYPE_IS_DECLARED 1
2007 # define YYLTYPE_IS_TRIVIAL 1
2008 #endif
2009
2010 ]b4_pure_if([], [[extern YYLTYPE ]b4_prefix[lloc;]])
2011 )dnl b4_locations_if
2012 b4_push_if([[
2013 #ifndef YYPUSH_DECLS
2014 # define YYPUSH_DECLS
2015 struct ]b4_prefix[pstate;
2016 typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
2017 enum { YYPUSH_MORE = 4 };
2018 ]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param)
2019 ])b4_c_function_decl([b4_prefix[push_parse]], [[int]],
2020 [[b4_prefix[pstate *yyps]], [[yyps]]]b4_pure_if([,
2021 [[[int yypushed_char]], [[yypushed_char]]],
2022 [[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
2023 [[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
2024 b4_parse_param]))
2025 b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
2026 [[b4_prefix[pstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
2027 b4_parse_param]))])
2028 b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
2029 [[[void]], []])
2030 b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
2031 [[b4_prefix[pstate *yyps]], [[yyps]]])[
2032 #endif
2033 ]])
2034 b4_percent_code_get([[provides]])[]dnl
2035 ])dnl b4_defines_if
2036 m4_divert_pop(0)