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