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