1 /* A Bison parser, made by GNU Bison 3.3.2. */ 2 3 /* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, 6 Inc. 7 8 This program is free software: you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 21 /* As a special exception, you may create a larger work that contains 22 part or all of the Bison parser skeleton and distribute that work 23 under terms of your choice, so long as that work isn't itself a 24 parser generator using the skeleton or a modified version thereof 25 as a parser skeleton. Alternatively, if you modify or redistribute 26 the parser skeleton itself, you may (at your option) remove this 27 special exception, which will cause the skeleton and the resulting 28 Bison output files to be licensed under the GNU General Public 29 License without this special exception. 30 31 This special exception was added by the Free Software Foundation in 32 version 2.2 of Bison. */ 33 34 /* C LALR(1) parser skeleton written by Richard Stallman, by is_stream_dop(u8_t * lptr,u8_t * rptr,int step,frames_t frames)35 simplifying the original so-called "semantic" parser. */ 36 37 /* All symbols defined below should begin with yy or YY, to avoid 38 infringing on user name space. This should be done even for local 39 variables, as they might otherwise be expanded by user macros. 40 There are some unavoidable exceptions within include files to 41 define necessary library symbols; they are noted "INFRINGES ON 42 USER NAME SPACE" below. */ 43 44 /* Undocumented macros, especially those whose name start with YY_, 45 are private implementation details. Do not rely on them. */ 46 47 /* Identify Bison output. */ 48 #define YYBISON 1 49 50 /* Bison version. */ 51 #define YYBISON_VERSION "3.3.2" 52 53 /* Skeleton name. */ 54 #define YYSKELETON_NAME "yacc.c" 55 56 /* Pure parsers. */ 57 #define YYPURE 0 58 59 /* Push parsers. */ 60 #define YYPUSH 0 61 62 /* Pull parsers. */ 63 #define YYPULL 1 64 65 66 /* Substitute the variable and function names. */ 67 #define yyparse seg_yyparse 68 #define yylex seg_yylex 69 #define yyerror seg_yyerror 70 #define yydebug seg_yydebug 71 #define yynerrs seg_yynerrs 72 73 #define yylval seg_yylval 74 #define yychar seg_yychar 75 76 /* First part of user prologue. */ 77 #line 1 "segparse.y" /* yacc.c:337 */ 78 79 /* contrib/seg/segparse.y */ 80 81 #include "postgres.h" 82 83 #include <math.h> 84 85 #include "fmgr.h" 86 #include "utils/builtins.h" 87 88 #include "segdata.h" 89 90 /* 91 * Bison doesn't allocate anything that needs to live across parser calls, 92 * so we can easily have it use palloc instead of malloc. This prevents 93 * memory leaks if we error out during parsing. Note this only works with 94 * bison >= 2.0. However, in bison 1.875 the default is to use alloca() 95 * if possible, so there's not really much problem anyhow, at least if 96 * you're building with gcc. 97 */ 98 #define YYMALLOC palloc 99 #define YYFREE pfree 100 101 static float seg_atof(const char *value); 102 103 static char strbuf[25] = { 104 '0', '0', '0', '0', '0', 105 '0', '0', '0', '0', '0', 106 '0', '0', '0', '0', '0', 107 '0', '0', '0', '0', '0', 108 '0', '0', '0', '0', '\0' 109 }; 110 111 112 #line 113 "segparse.c" /* yacc.c:337 */ 113 # ifndef YY_NULLPTR 114 # if defined __cplusplus 115 # if 201103L <= __cplusplus 116 # define YY_NULLPTR nullptr 117 # else 118 # define YY_NULLPTR 0 119 # endif 120 # else 121 # define YY_NULLPTR ((void*)0) 122 # endif 123 # endif 124 125 /* Enabling verbose error messages. */ 126 #ifdef YYERROR_VERBOSE 127 # undef YYERROR_VERBOSE 128 # define YYERROR_VERBOSE 1 129 #else 130 # define YYERROR_VERBOSE 0 131 #endif 132 133 134 /* Debug traces. */ 135 #ifndef YYDEBUG 136 # define YYDEBUG 0 137 #endif 138 #if YYDEBUG 139 extern int seg_yydebug; 140 #endif 141 142 /* Token type. */ 143 #ifndef YYTOKENTYPE 144 # define YYTOKENTYPE 145 enum yytokentype 146 { 147 SEGFLOAT = 258, 148 RANGE = 259, 149 PLUMIN = 260, 150 EXTENSION = 261 151 }; 152 #endif 153 154 /* Value type. */ 155 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 156 157 union YYSTYPE 158 { 159 #line 41 "segparse.y" /* yacc.c:352 */ 160 161 struct BND { 162 float val; 163 char ext; 164 char sigd; 165 } bnd; 166 char * text; 167 168 #line 169 "segparse.c" /* yacc.c:352 */ 169 }; 170 171 typedef union YYSTYPE YYSTYPE; 172 # define YYSTYPE_IS_TRIVIAL 1 173 # define YYSTYPE_IS_DECLARED 1 174 #endif 175 176 177 extern YYSTYPE seg_yylval; 178 179 int seg_yyparse (SEG *result); 180 181 182 183 184 185 #ifdef short 186 # undef short 187 #endif 188 189 #ifdef YYTYPE_UINT8 190 typedef YYTYPE_UINT8 yytype_uint8; 191 #else 192 typedef unsigned char yytype_uint8; 193 #endif 194 195 #ifdef YYTYPE_INT8 196 typedef YYTYPE_INT8 yytype_int8; 197 #else 198 typedef signed char yytype_int8; 199 #endif 200 201 #ifdef YYTYPE_UINT16 202 typedef YYTYPE_UINT16 yytype_uint16; 203 #else 204 typedef unsigned short yytype_uint16; 205 #endif 206 207 #ifdef YYTYPE_INT16 208 typedef YYTYPE_INT16 yytype_int16; 209 #else 210 typedef short yytype_int16; 211 #endif 212 213 #ifndef YYSIZE_T 214 # ifdef __SIZE_TYPE__ 215 # define YYSIZE_T __SIZE_TYPE__ 216 # elif defined size_t 217 # define YYSIZE_T size_t 218 # elif ! defined YYSIZE_T 219 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 220 # define YYSIZE_T size_t 221 # else 222 # define YYSIZE_T unsigned 223 # endif 224 #endif 225 226 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 227 228 #ifndef YY_ 229 # if defined YYENABLE_NLS && YYENABLE_NLS 230 # if ENABLE_NLS 231 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 232 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 233 # endif 234 # endif 235 # ifndef YY_ 236 # define YY_(Msgid) Msgid 237 # endif 238 #endif 239 240 #ifndef YY_ATTRIBUTE 241 # if (defined __GNUC__ \ 242 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 243 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 244 # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 245 # else 246 # define YY_ATTRIBUTE(Spec) /* empty */ 247 # endif 248 #endif 249 250 #ifndef YY_ATTRIBUTE_PURE 251 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 252 #endif 253 254 #ifndef YY_ATTRIBUTE_UNUSED 255 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 256 #endif 257 258 /* Suppress unused-variable warnings by "using" E. */ 259 #if ! defined lint || defined __GNUC__ 260 # define YYUSE(E) ((void) (E)) 261 #else 262 # define YYUSE(E) /* empty */ 263 #endif 264 265 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 266 /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 267 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 268 _Pragma ("GCC diagnostic push") \ 269 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 270 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 271 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 272 _Pragma ("GCC diagnostic pop") 273 #else 274 # define YY_INITIAL_VALUE(Value) Value 275 #endif 276 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 277 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 278 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 279 #endif 280 #ifndef YY_INITIAL_VALUE 281 # define YY_INITIAL_VALUE(Value) /* Nothing. */ 282 #endif 283 284 285 #if ! defined yyoverflow || YYERROR_VERBOSE 286 287 /* The parser invokes alloca or malloc; define the necessary symbols. */ 288 289 # ifdef YYSTACK_USE_ALLOCA 290 # if YYSTACK_USE_ALLOCA 291 # ifdef __GNUC__ 292 # define YYSTACK_ALLOC __builtin_alloca 293 # elif defined __BUILTIN_VA_ARG_INCR 294 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 295 # elif defined _AIX 296 # define YYSTACK_ALLOC __alloca 297 # elif defined _MSC_VER 298 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 299 # define alloca _alloca 300 # else 301 # define YYSTACK_ALLOC alloca 302 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 303 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 304 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 305 # ifndef EXIT_SUCCESS 306 # define EXIT_SUCCESS 0 307 # endif 308 # endif 309 # endif 310 # endif 311 # endif 312 313 # ifdef YYSTACK_ALLOC 314 /* Pacify GCC's 'empty if-body' warning. */ 315 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 316 # ifndef YYSTACK_ALLOC_MAXIMUM 317 /* The OS might guarantee only one guard page at the bottom of the stack, 318 and a page size can be as small as 4096 bytes. So we cannot safely 319 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 320 to allow for a few compiler-allocated temporary stack slots. */ 321 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 322 # endif 323 # else 324 # define YYSTACK_ALLOC YYMALLOC 325 # define YYSTACK_FREE YYFREE 326 # ifndef YYSTACK_ALLOC_MAXIMUM 327 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 328 # endif 329 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 330 && ! ((defined YYMALLOC || defined malloc) \ 331 && (defined YYFREE || defined free))) 332 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 333 # ifndef EXIT_SUCCESS 334 # define EXIT_SUCCESS 0 335 # endif 336 # endif 337 # ifndef YYMALLOC 338 # define YYMALLOC malloc 339 # if ! defined malloc && ! defined EXIT_SUCCESS 340 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 341 # endif 342 # endif 343 # ifndef YYFREE 344 # define YYFREE free 345 # if ! defined free && ! defined EXIT_SUCCESS 346 void free (void *); /* INFRINGES ON USER NAME SPACE */ 347 # endif 348 # endif 349 # endif 350 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 351 352 353 #if (! defined yyoverflow \ 354 && (! defined __cplusplus \ 355 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 356 357 /* A type that is properly aligned for any stack member. */ 358 union yyalloc 359 { 360 yytype_int16 yyss_alloc; 361 YYSTYPE yyvs_alloc; 362 }; 363 364 /* The size of the maximum gap between one aligned stack and the next. */ 365 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 366 367 /* The size of an array large to enough to hold all stacks, each with 368 N elements. */ 369 # define YYSTACK_BYTES(N) \ 370 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 371 + YYSTACK_GAP_MAXIMUM) 372 373 # define YYCOPY_NEEDED 1 374 375 /* Relocate STACK from its old location to the new one. The 376 local variables YYSIZE and YYSTACKSIZE give the old and new number of 377 elements in the stack, and YYPTR gives the new location of the 378 stack. Advance YYPTR to a properly aligned location for the next 379 stack. */ 380 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 381 do \ 382 { \ 383 YYSIZE_T yynewbytes; \ 384 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 385 Stack = &yyptr->Stack_alloc; \ 386 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 387 yyptr += yynewbytes / sizeof (*yyptr); \ 388 } \ 389 while (0) 390 391 #endif 392 393 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 394 /* Copy COUNT objects from SRC to DST. The source and destination do 395 not overlap. */ 396 # ifndef YYCOPY 397 # if defined __GNUC__ && 1 < __GNUC__ 398 # define YYCOPY(Dst, Src, Count) \ 399 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 400 # else 401 # define YYCOPY(Dst, Src, Count) \ 402 do \ 403 { \ 404 YYSIZE_T yyi; \ 405 for (yyi = 0; yyi < (Count); yyi++) \ 406 (Dst)[yyi] = (Src)[yyi]; \ 407 } \ 408 while (0) 409 # endif 410 # endif 411 #endif /* !YYCOPY_NEEDED */ 412 413 /* YYFINAL -- State number of the termination state. */ 414 #define YYFINAL 8 415 /* YYLAST -- Last index in YYTABLE. */ 416 #define YYLAST 12 417 418 /* YYNTOKENS -- Number of terminals. */ 419 #define YYNTOKENS 7 420 /* YYNNTS -- Number of nonterminals. */ 421 #define YYNNTS 4 422 /* YYNRULES -- Number of rules. */ 423 #define YYNRULES 9 424 /* YYNSTATES -- Number of states. */ 425 #define YYNSTATES 14 426 427 #define YYUNDEFTOK 2 428 #define YYMAXUTOK 261 429 430 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM 431 as returned by yylex, with out-of-bounds checking. */ 432 #define YYTRANSLATE(YYX) \ 433 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 434 435 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 436 as returned by yylex. */ 437 static const yytype_uint8 yytranslate[] = 438 { 439 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 464 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 465 5, 6 466 }; 467 468 #if YYDEBUG 469 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 470 static const yytype_uint8 yyrline[] = 471 { 472 0, 61, 61, 73, 91, 101, 111, 119, 128, 139 473 }; 474 #endif 475 476 #if YYDEBUG || YYERROR_VERBOSE || 0 477 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 478 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 479 static const char *const yytname[] = 480 { 481 "$end", "error", "$undefined", "SEGFLOAT", "RANGE", "PLUMIN", 482 "EXTENSION", "$accept", "range", "boundary", "deviation", YY_NULLPTR 483 }; 484 #endif 485 486 # ifdef YYPRINT 487 /* YYTOKNUM[NUM] -- (External) token number corresponding to the 488 (internal) symbol number NUM (which must be that of a token). */ 489 static const yytype_uint16 yytoknum[] = 490 { 491 0, 256, 257, 258, 259, 260, 261 492 }; 493 # endif 494 495 #define YYPACT_NINF -3 496 497 #define yypact_value_is_default(Yystate) \ 498 (!!((Yystate) == (-3))) 499 500 #define YYTABLE_NINF -1 501 502 #define yytable_value_is_error(Yytable_value) \ 503 0 504 505 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 506 STATE-NUM. */ 507 static const yytype_int8 yypact[] = 508 { 509 -1, -3, 3, 1, 8, 6, -3, -3, -3, 3, 510 9, -3, -3, -3 511 }; 512 513 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 514 Performed when YYTABLE does not specify something else to do. Zero 515 means the default is an error. */ 516 static const yytype_uint8 yydefact[] = 517 { 518 0, 7, 0, 0, 0, 6, 5, 8, 1, 4, 519 0, 3, 9, 2 520 }; 521 522 /* YYPGOTO[NTERM-NUM]. */ 523 static const yytype_int8 yypgoto[] = 524 { 525 -3, -3, -2, -3 526 }; 527 528 /* YYDEFGOTO[NTERM-NUM]. */ 529 static const yytype_int8 yydefgoto[] = 530 { 531 -1, 4, 5, 13 532 }; 533 534 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 535 positive, shift that token. If negative, reduce the rule whose 536 number is the opposite. If YYTABLE_NINF, syntax error. */ 537 static const yytype_uint8 yytable[] = 538 { 539 6, 0, 1, 2, 7, 3, 1, 11, 8, 3, 540 9, 10, 12 541 }; 542 543 static const yytype_int8 yycheck[] = 544 { 545 2, -1, 3, 4, 3, 6, 3, 9, 0, 6, 546 4, 5, 3 547 }; 548 549 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 550 symbol of state STATE-NUM. */ 551 static const yytype_uint8 yystos[] = 552 { 553 0, 3, 4, 6, 8, 9, 9, 3, 0, 4, 554 5, 9, 3, 10 555 }; 556 557 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 558 static const yytype_uint8 yyr1[] = 559 { 560 0, 7, 8, 8, 8, 8, 8, 9, 9, 10 561 }; 562 563 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ 564 static const yytype_uint8 yyr2[] = 565 { 566 0, 2, 3, 3, 2, 2, 1, 1, 2, 1 567 }; 568 569 570 #define yyerrok (yyerrstatus = 0) 571 #define yyclearin (yychar = YYEMPTY) 572 #define YYEMPTY (-2) 573 #define YYEOF 0 574 575 #define YYACCEPT goto yyacceptlab 576 #define YYABORT goto yyabortlab 577 #define YYERROR goto yyerrorlab 578 579 580 #define YYRECOVERING() (!!yyerrstatus) 581 582 #define YYBACKUP(Token, Value) \ 583 do \ 584 if (yychar == YYEMPTY) \ 585 { \ 586 yychar = (Token); \ 587 yylval = (Value); \ 588 YYPOPSTACK (yylen); \ 589 yystate = *yyssp; \ 590 goto yybackup; \ 591 } \ 592 else \ 593 { \ 594 yyerror (result, YY_("syntax error: cannot back up")); \ 595 YYERROR; \ 596 } \ 597 while (0) 598 599 /* Error token number */ 600 #define YYTERROR 1 601 #define YYERRCODE 256 602 603 604 605 /* Enable debugging if requested. */ 606 #if YYDEBUG 607 608 # ifndef YYFPRINTF 609 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 610 # define YYFPRINTF fprintf 611 # endif 612 613 # define YYDPRINTF(Args) \ 614 do { \ 615 if (yydebug) \ 616 YYFPRINTF Args; \ 617 } while (0) 618 619 /* This macro is provided for backward compatibility. */ 620 #ifndef YY_LOCATION_PRINT 621 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 622 #endif 623 624 625 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 626 do { \ 627 if (yydebug) \ 628 { \ 629 YYFPRINTF (stderr, "%s ", Title); \ 630 yy_symbol_print (stderr, \ 631 Type, Value, result); \ 632 YYFPRINTF (stderr, "\n"); \ 633 } \ 634 } while (0) 635 636 637 /*-----------------------------------. 638 | Print this symbol's value on YYO. | 639 `-----------------------------------*/ 640 641 static void 642 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, SEG *result) 643 { 644 FILE *yyoutput = yyo; 645 YYUSE (yyoutput); 646 YYUSE (result); 647 if (!yyvaluep) 648 return; 649 # ifdef YYPRINT 650 if (yytype < YYNTOKENS) 651 YYPRINT (yyo, yytoknum[yytype], *yyvaluep); 652 # endif 653 YYUSE (yytype); 654 } 655 656 657 /*---------------------------. 658 | Print this symbol on YYO. | 659 `---------------------------*/ 660 661 static void 662 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, SEG *result) 663 { 664 YYFPRINTF (yyo, "%s %s (", 665 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); 666 667 yy_symbol_value_print (yyo, yytype, yyvaluep, result); 668 YYFPRINTF (yyo, ")"); 669 } 670 671 /*------------------------------------------------------------------. 672 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 673 | TOP (included). | 674 `------------------------------------------------------------------*/ 675 676 static void 677 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 678 { 679 YYFPRINTF (stderr, "Stack now"); 680 for (; yybottom <= yytop; yybottom++) 681 { 682 int yybot = *yybottom; 683 YYFPRINTF (stderr, " %d", yybot); 684 } 685 YYFPRINTF (stderr, "\n"); 686 } 687 688 # define YY_STACK_PRINT(Bottom, Top) \ 689 do { \ 690 if (yydebug) \ 691 yy_stack_print ((Bottom), (Top)); \ 692 } while (0) 693 694 695 /*------------------------------------------------. 696 | Report that the YYRULE is going to be reduced. | 697 `------------------------------------------------*/ 698 699 static void 700 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, SEG *result) 701 { 702 unsigned long yylno = yyrline[yyrule]; 703 int yynrhs = yyr2[yyrule]; 704 int yyi; 705 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 706 yyrule - 1, yylno); 707 /* The symbols being reduced. */ 708 for (yyi = 0; yyi < yynrhs; yyi++) 709 { 710 YYFPRINTF (stderr, " $%d = ", yyi + 1); 711 yy_symbol_print (stderr, 712 yystos[yyssp[yyi + 1 - yynrhs]], 713 &yyvsp[(yyi + 1) - (yynrhs)] 714 , result); 715 YYFPRINTF (stderr, "\n"); 716 } 717 } 718 719 # define YY_REDUCE_PRINT(Rule) \ 720 do { \ 721 if (yydebug) \ 722 yy_reduce_print (yyssp, yyvsp, Rule, result); \ 723 } while (0) 724 725 /* Nonzero means print parse trace. It is left uninitialized so that 726 multiple parsers can coexist. */ 727 int yydebug; 728 #else /* !YYDEBUG */ 729 # define YYDPRINTF(Args) 730 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 731 # define YY_STACK_PRINT(Bottom, Top) 732 # define YY_REDUCE_PRINT(Rule) 733 #endif /* !YYDEBUG */ 734 735 736 /* YYINITDEPTH -- initial size of the parser's stacks. */ 737 #ifndef YYINITDEPTH 738 # define YYINITDEPTH 200 739 #endif 740 741 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 742 if the built-in stack extension method is used). 743 744 Do not make this value too large; the results are undefined if 745 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 746 evaluated with infinite-precision integer arithmetic. */ 747 748 #ifndef YYMAXDEPTH 749 # define YYMAXDEPTH 10000 750 #endif 751 752 753 #if YYERROR_VERBOSE 754 755 # ifndef yystrlen 756 # if defined __GLIBC__ && defined _STRING_H 757 # define yystrlen strlen 758 # else 759 /* Return the length of YYSTR. */ 760 static YYSIZE_T 761 yystrlen (const char *yystr) 762 { 763 YYSIZE_T yylen; 764 for (yylen = 0; yystr[yylen]; yylen++) 765 continue; 766 return yylen; 767 } 768 # endif 769 # endif 770 771 # ifndef yystpcpy 772 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 773 # define yystpcpy stpcpy 774 # else 775 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 776 YYDEST. */ 777 static char * 778 yystpcpy (char *yydest, const char *yysrc) 779 { 780 char *yyd = yydest; 781 const char *yys = yysrc; 782 783 while ((*yyd++ = *yys++) != '\0') 784 continue; 785 786 return yyd - 1; 787 } 788 # endif 789 # endif 790 791 # ifndef yytnamerr 792 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 793 quotes and backslashes, so that it's suitable for yyerror. The 794 heuristic is that double-quoting is unnecessary unless the string 795 contains an apostrophe, a comma, or backslash (other than 796 backslash-backslash). YYSTR is taken from yytname. If YYRES is 797 null, do not copy; instead, return the length of what the result 798 would have been. */ 799 static YYSIZE_T 800 yytnamerr (char *yyres, const char *yystr) 801 { 802 if (*yystr == '"') 803 { 804 YYSIZE_T yyn = 0; 805 char const *yyp = yystr; 806 807 for (;;) 808 switch (*++yyp) 809 { 810 case '\'': 811 case ',': 812 goto do_not_strip_quotes; 813 814 case '\\': 815 if (*++yyp != '\\') 816 goto do_not_strip_quotes; 817 else 818 goto append; 819 820 append: 821 default: 822 if (yyres) 823 yyres[yyn] = *yyp; 824 yyn++; 825 break; 826 827 case '"': 828 if (yyres) 829 yyres[yyn] = '\0'; 830 return yyn; 831 } 832 do_not_strip_quotes: ; 833 } 834 835 if (! yyres) 836 return yystrlen (yystr); 837 838 return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); 839 } 840 # endif 841 842 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 843 about the unexpected token YYTOKEN for the state stack whose top is 844 YYSSP. 845 846 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 847 not large enough to hold the message. In that case, also set 848 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 849 required number of bytes is too large to store. */ 850 static int 851 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 852 yytype_int16 *yyssp, int yytoken) 853 { 854 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); 855 YYSIZE_T yysize = yysize0; 856 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 857 /* Internationalized format string. */ 858 const char *yyformat = YY_NULLPTR; 859 /* Arguments of yyformat. */ 860 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 861 /* Number of reported tokens (one for the "unexpected", one per 862 "expected"). */ 863 int yycount = 0; 864 865 /* There are many possibilities here to consider: 866 - If this state is a consistent state with a default action, then 867 the only way this function was invoked is if the default action 868 is an error action. In that case, don't check for expected 869 tokens because there are none. 870 - The only way there can be no lookahead present (in yychar) is if 871 this state is a consistent state with a default action. Thus, 872 detecting the absence of a lookahead is sufficient to determine 873 that there is no unexpected or expected token to report. In that 874 case, just report a simple "syntax error". 875 - Don't assume there isn't a lookahead just because this state is a 876 consistent state with a default action. There might have been a 877 previous inconsistent state, consistent state with a non-default 878 action, or user semantic action that manipulated yychar. 879 - Of course, the expected token list depends on states to have 880 correct lookahead information, and it depends on the parser not 881 to perform extra reductions after fetching a lookahead from the 882 scanner and before detecting a syntax error. Thus, state merging 883 (from LALR or IELR) and default reductions corrupt the expected 884 token list. However, the list is correct for canonical LR with 885 one exception: it will still contain any token that will not be 886 accepted due to an error action in a later state. 887 */ 888 if (yytoken != YYEMPTY) 889 { 890 int yyn = yypact[*yyssp]; 891 yyarg[yycount++] = yytname[yytoken]; 892 if (!yypact_value_is_default (yyn)) 893 { 894 /* Start YYX at -YYN if negative to avoid negative indexes in 895 YYCHECK. In other words, skip the first -YYN actions for 896 this state because they are default actions. */ 897 int yyxbegin = yyn < 0 ? -yyn : 0; 898 /* Stay within bounds of both yycheck and yytname. */ 899 int yychecklim = YYLAST - yyn + 1; 900 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 901 int yyx; 902 903 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 904 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 905 && !yytable_value_is_error (yytable[yyx + yyn])) 906 { 907 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 908 { 909 yycount = 1; 910 yysize = yysize0; 911 break; 912 } 913 yyarg[yycount++] = yytname[yyx]; 914 { 915 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); 916 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) 917 yysize = yysize1; 918 else 919 return 2; 920 } 921 } 922 } 923 } 924 925 switch (yycount) 926 { 927 # define YYCASE_(N, S) \ 928 case N: \ 929 yyformat = S; \ 930 break 931 default: /* Avoid compiler warnings. */ 932 YYCASE_(0, YY_("syntax error")); 933 YYCASE_(1, YY_("syntax error, unexpected %s")); 934 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 935 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 936 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 937 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 938 # undef YYCASE_ 939 } 940 941 { 942 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 943 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) 944 yysize = yysize1; 945 else 946 return 2; 947 } 948 949 if (*yymsg_alloc < yysize) 950 { 951 *yymsg_alloc = 2 * yysize; 952 if (! (yysize <= *yymsg_alloc 953 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 954 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 955 return 1; 956 } 957 958 /* Avoid sprintf, as that infringes on the user's name space. 959 Don't have undefined behavior even if the translation 960 produced a string with the wrong number of "%s"s. */ 961 { 962 char *yyp = *yymsg; 963 int yyi = 0; 964 while ((*yyp = *yyformat) != '\0') 965 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 966 { 967 yyp += yytnamerr (yyp, yyarg[yyi++]); 968 yyformat += 2; 969 } 970 else 971 { 972 yyp++; 973 yyformat++; 974 } 975 } 976 return 0; 977 } 978 #endif /* YYERROR_VERBOSE */ 979 980 /*-----------------------------------------------. 981 | Release the memory associated to this symbol. | 982 `-----------------------------------------------*/ 983 984 static void 985 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, SEG *result) 986 { 987 YYUSE (yyvaluep); 988 YYUSE (result); 989 if (!yymsg) 990 yymsg = "Deleting"; 991 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 992 993 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 994 YYUSE (yytype); 995 YY_IGNORE_MAYBE_UNINITIALIZED_END 996 } 997 998 999 1000 1001 /* The lookahead symbol. */ 1002 int yychar; 1003 1004 /* The semantic value of the lookahead symbol. */ 1005 YYSTYPE yylval; 1006 /* Number of syntax errors so far. */ 1007 int yynerrs; 1008 1009 1010 /*----------. 1011 | yyparse. | 1012 `----------*/ 1013 1014 int 1015 yyparse (SEG *result) 1016 { 1017 int yystate; 1018 /* Number of tokens to shift before error messages enabled. */ 1019 int yyerrstatus; 1020 1021 /* The stacks and their tools: 1022 'yyss': related to states. 1023 'yyvs': related to semantic values. 1024 1025 Refer to the stacks through separate pointers, to allow yyoverflow 1026 to reallocate them elsewhere. */ 1027 1028 /* The state stack. */ 1029 yytype_int16 yyssa[YYINITDEPTH]; 1030 yytype_int16 *yyss; 1031 yytype_int16 *yyssp; 1032 1033 /* The semantic value stack. */ 1034 YYSTYPE yyvsa[YYINITDEPTH]; 1035 YYSTYPE *yyvs; 1036 YYSTYPE *yyvsp; 1037 1038 YYSIZE_T yystacksize; 1039 1040 int yyn; 1041 int yyresult; 1042 /* Lookahead token as an internal (translated) token number. */ 1043 int yytoken = 0; 1044 /* The variables used to return semantic value and location from the 1045 action routines. */ 1046 YYSTYPE yyval; 1047 1048 #if YYERROR_VERBOSE 1049 /* Buffer for error messages, and its allocated size. */ 1050 char yymsgbuf[128]; 1051 char *yymsg = yymsgbuf; 1052 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1053 #endif 1054 1055 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1056 1057 /* The number of symbols on the RHS of the reduced rule. 1058 Keep to zero when no symbol should be popped. */ 1059 int yylen = 0; 1060 1061 yyssp = yyss = yyssa; 1062 yyvsp = yyvs = yyvsa; 1063 yystacksize = YYINITDEPTH; 1064 1065 YYDPRINTF ((stderr, "Starting parse\n")); 1066 1067 yystate = 0; 1068 yyerrstatus = 0; 1069 yynerrs = 0; 1070 yychar = YYEMPTY; /* Cause a token to be read. */ 1071 goto yysetstate; 1072 1073 1074 /*------------------------------------------------------------. 1075 | yynewstate -- push a new state, which is found in yystate. | 1076 `------------------------------------------------------------*/ 1077 yynewstate: 1078 /* In all cases, when you get here, the value and location stacks 1079 have just been pushed. So pushing a state here evens the stacks. */ 1080 yyssp++; 1081 1082 1083 /*--------------------------------------------------------------------. 1084 | yynewstate -- set current state (the top of the stack) to yystate. | 1085 `--------------------------------------------------------------------*/ 1086 yysetstate: 1087 *yyssp = (yytype_int16) yystate; 1088 1089 if (yyss + yystacksize - 1 <= yyssp) 1090 #if !defined yyoverflow && !defined YYSTACK_RELOCATE 1091 goto yyexhaustedlab; 1092 #else 1093 { 1094 /* Get the current used size of the three stacks, in elements. */ 1095 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); 1096 1097 # if defined yyoverflow 1098 { 1099 /* Give user a chance to reallocate the stack. Use copies of 1100 these so that the &'s don't force the real ones into 1101 memory. */ 1102 YYSTYPE *yyvs1 = yyvs; 1103 yytype_int16 *yyss1 = yyss; 1104 1105 /* Each stack pointer address is followed by the size of the 1106 data in use in that stack, in bytes. This used to be a 1107 conditional around just the two extra args, but that might 1108 be undefined if yyoverflow is a macro. */ 1109 yyoverflow (YY_("memory exhausted"), 1110 &yyss1, yysize * sizeof (*yyssp), 1111 &yyvs1, yysize * sizeof (*yyvsp), 1112 &yystacksize); 1113 yyss = yyss1; 1114 yyvs = yyvs1; 1115 } 1116 # else /* defined YYSTACK_RELOCATE */ 1117 /* Extend the stack our own way. */ 1118 if (YYMAXDEPTH <= yystacksize) 1119 goto yyexhaustedlab; 1120 yystacksize *= 2; 1121 if (YYMAXDEPTH < yystacksize) 1122 yystacksize = YYMAXDEPTH; 1123 1124 { 1125 yytype_int16 *yyss1 = yyss; 1126 union yyalloc *yyptr = 1127 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1128 if (! yyptr) 1129 goto yyexhaustedlab; 1130 YYSTACK_RELOCATE (yyss_alloc, yyss); 1131 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1132 # undef YYSTACK_RELOCATE 1133 if (yyss1 != yyssa) 1134 YYSTACK_FREE (yyss1); 1135 } 1136 # endif 1137 1138 yyssp = yyss + yysize - 1; 1139 yyvsp = yyvs + yysize - 1; 1140 1141 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1142 (unsigned long) yystacksize)); 1143 1144 if (yyss + yystacksize - 1 <= yyssp) 1145 YYABORT; 1146 } 1147 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ 1148 1149 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1150 1151 if (yystate == YYFINAL) 1152 YYACCEPT; 1153 1154 goto yybackup; 1155 1156 1157 /*-----------. 1158 | yybackup. | 1159 `-----------*/ 1160 yybackup: 1161 /* Do appropriate processing given the current state. Read a 1162 lookahead token if we need one and don't already have one. */ 1163 1164 /* First try to decide what to do without reference to lookahead token. */ 1165 yyn = yypact[yystate]; 1166 if (yypact_value_is_default (yyn)) 1167 goto yydefault; 1168 1169 /* Not known => get a lookahead token if don't already have one. */ 1170 1171 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1172 if (yychar == YYEMPTY) 1173 { 1174 YYDPRINTF ((stderr, "Reading a token: ")); 1175 yychar = yylex (); 1176 } 1177 1178 if (yychar <= YYEOF) 1179 { 1180 yychar = yytoken = YYEOF; 1181 YYDPRINTF ((stderr, "Now at end of input.\n")); 1182 } 1183 else 1184 { 1185 yytoken = YYTRANSLATE (yychar); 1186 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1187 } 1188 1189 /* If the proper action on seeing token YYTOKEN is to reduce or to 1190 detect an error, take that action. */ 1191 yyn += yytoken; 1192 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1193 goto yydefault; 1194 yyn = yytable[yyn]; 1195 if (yyn <= 0) 1196 { 1197 if (yytable_value_is_error (yyn)) 1198 goto yyerrlab; 1199 yyn = -yyn; 1200 goto yyreduce; 1201 } 1202 1203 /* Count tokens shifted since error; after three, turn off error 1204 status. */ 1205 if (yyerrstatus) 1206 yyerrstatus--; 1207 1208 /* Shift the lookahead token. */ 1209 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1210 1211 /* Discard the shifted token. */ 1212 yychar = YYEMPTY; 1213 1214 yystate = yyn; 1215 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1216 *++yyvsp = yylval; 1217 YY_IGNORE_MAYBE_UNINITIALIZED_END 1218 1219 goto yynewstate; 1220 1221 1222 /*-----------------------------------------------------------. 1223 | yydefault -- do the default action for the current state. | 1224 `-----------------------------------------------------------*/ 1225 yydefault: 1226 yyn = yydefact[yystate]; 1227 if (yyn == 0) 1228 goto yyerrlab; 1229 goto yyreduce; 1230 1231 1232 /*-----------------------------. 1233 | yyreduce -- do a reduction. | 1234 `-----------------------------*/ 1235 yyreduce: 1236 /* yyn is the number of a rule to reduce with. */ 1237 yylen = yyr2[yyn]; 1238 1239 /* If YYLEN is nonzero, implement the default value of the action: 1240 '$$ = $1'. 1241 1242 Otherwise, the following line sets YYVAL to garbage. 1243 This behavior is undocumented and Bison 1244 users should not rely upon it. Assigning to YYVAL 1245 unconditionally makes the parser a bit smaller, and it avoids a 1246 GCC warning that YYVAL may be used uninitialized. */ 1247 yyval = yyvsp[1-yylen]; 1248 1249 1250 YY_REDUCE_PRINT (yyn); 1251 switch (yyn) 1252 { 1253 case 2: 1254 #line 62 "segparse.y" /* yacc.c:1652 */ 1255 { 1256 result->lower = (yyvsp[-2].bnd).val - (yyvsp[0].bnd).val; 1257 result->upper = (yyvsp[-2].bnd).val + (yyvsp[0].bnd).val; 1258 sprintf(strbuf, "%g", result->lower); 1259 result->l_sigd = Max(Min(6, significant_digits(strbuf)), Max((yyvsp[-2].bnd).sigd, (yyvsp[0].bnd).sigd)); 1260 sprintf(strbuf, "%g", result->upper); 1261 result->u_sigd = Max(Min(6, significant_digits(strbuf)), Max((yyvsp[-2].bnd).sigd, (yyvsp[0].bnd).sigd)); 1262 result->l_ext = '\0'; 1263 result->u_ext = '\0'; 1264 } 1265 #line 1266 "segparse.c" /* yacc.c:1652 */ 1266 break; 1267 1268 case 3: 1269 #line 74 "segparse.y" /* yacc.c:1652 */ 1270 { 1271 result->lower = (yyvsp[-2].bnd).val; 1272 result->upper = (yyvsp[0].bnd).val; 1273 if ( result->lower > result->upper ) { 1274 ereport(ERROR, 1275 (errcode(ERRCODE_INVALID_PARAMETER_VALUE), 1276 errmsg("swapped boundaries: %g is greater than %g", 1277 result->lower, result->upper))); 1278 1279 YYERROR; 1280 } 1281 result->l_sigd = (yyvsp[-2].bnd).sigd; 1282 result->u_sigd = (yyvsp[0].bnd).sigd; 1283 result->l_ext = ( (yyvsp[-2].bnd).ext ? (yyvsp[-2].bnd).ext : '\0' ); 1284 result->u_ext = ( (yyvsp[0].bnd).ext ? (yyvsp[0].bnd).ext : '\0' ); 1285 } 1286 #line 1287 "segparse.c" /* yacc.c:1652 */ 1287 break; 1288 1289 case 4: 1290 #line 92 "segparse.y" /* yacc.c:1652 */ 1291 { 1292 result->lower = (yyvsp[-1].bnd).val; 1293 result->upper = HUGE_VAL; 1294 result->l_sigd = (yyvsp[-1].bnd).sigd; 1295 result->u_sigd = 0; 1296 result->l_ext = ( (yyvsp[-1].bnd).ext ? (yyvsp[-1].bnd).ext : '\0' ); 1297 result->u_ext = '-'; 1298 } 1299 #line 1300 "segparse.c" /* yacc.c:1652 */ 1300 break; 1301 1302 case 5: 1303 #line 102 "segparse.y" /* yacc.c:1652 */ 1304 { 1305 result->lower = -HUGE_VAL; 1306 result->upper = (yyvsp[0].bnd).val; 1307 result->l_sigd = 0; 1308 result->u_sigd = (yyvsp[0].bnd).sigd; 1309 result->l_ext = '-'; 1310 result->u_ext = ( (yyvsp[0].bnd).ext ? (yyvsp[0].bnd).ext : '\0' ); 1311 } 1312 #line 1313 "segparse.c" /* yacc.c:1652 */ 1313 break; 1314 1315 case 6: 1316 #line 112 "segparse.y" /* yacc.c:1652 */ 1317 { 1318 result->lower = result->upper = (yyvsp[0].bnd).val; 1319 result->l_sigd = result->u_sigd = (yyvsp[0].bnd).sigd; 1320 result->l_ext = result->u_ext = ( (yyvsp[0].bnd).ext ? (yyvsp[0].bnd).ext : '\0' ); 1321 } 1322 #line 1323 "segparse.c" /* yacc.c:1652 */ 1323 break; 1324 1325 case 7: 1326 #line 120 "segparse.y" /* yacc.c:1652 */ 1327 { 1328 /* temp variable avoids a gcc 3.3.x bug on Sparc64 */ 1329 float val = seg_atof((yyvsp[0].text)); 1330 1331 (yyval.bnd).ext = '\0'; 1332 (yyval.bnd).sigd = significant_digits((yyvsp[0].text)); 1333 (yyval.bnd).val = val; 1334 } 1335 #line 1336 "segparse.c" /* yacc.c:1652 */ 1336 break; 1337 1338 case 8: 1339 #line 129 "segparse.y" /* yacc.c:1652 */ 1340 { 1341 /* temp variable avoids a gcc 3.3.x bug on Sparc64 */ 1342 float val = seg_atof((yyvsp[0].text)); 1343 1344 (yyval.bnd).ext = (yyvsp[-1].text)[0]; 1345 (yyval.bnd).sigd = significant_digits((yyvsp[0].text)); 1346 (yyval.bnd).val = val; 1347 } 1348 #line 1349 "segparse.c" /* yacc.c:1652 */ 1349 break; 1350 1351 case 9: 1352 #line 140 "segparse.y" /* yacc.c:1652 */ 1353 { 1354 /* temp variable avoids a gcc 3.3.x bug on Sparc64 */ 1355 float val = seg_atof((yyvsp[0].text)); 1356 1357 (yyval.bnd).ext = '\0'; 1358 (yyval.bnd).sigd = significant_digits((yyvsp[0].text)); 1359 (yyval.bnd).val = val; 1360 } 1361 #line 1362 "segparse.c" /* yacc.c:1652 */ 1362 break; 1363 1364 1365 #line 1366 "segparse.c" /* yacc.c:1652 */ 1366 default: break; 1367 } 1368 /* User semantic actions sometimes alter yychar, and that requires 1369 that yytoken be updated with the new translation. We take the 1370 approach of translating immediately before every use of yytoken. 1371 One alternative is translating here after every semantic action, 1372 but that translation would be missed if the semantic action invokes 1373 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1374 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1375 incorrect destructor might then be invoked immediately. In the 1376 case of YYERROR or YYBACKUP, subsequent parser actions might lead 1377 to an incorrect destructor call or verbose syntax error message 1378 before the lookahead is translated. */ 1379 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1380 1381 YYPOPSTACK (yylen); 1382 yylen = 0; 1383 YY_STACK_PRINT (yyss, yyssp); 1384 1385 *++yyvsp = yyval; 1386 1387 /* Now 'shift' the result of the reduction. Determine what state 1388 that goes to, based on the state we popped back to and the rule 1389 number reduced by. */ 1390 { 1391 const int yylhs = yyr1[yyn] - YYNTOKENS; 1392 const int yyi = yypgoto[yylhs] + *yyssp; 1393 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp 1394 ? yytable[yyi] 1395 : yydefgoto[yylhs]); 1396 } 1397 1398 goto yynewstate; 1399 1400 1401 /*--------------------------------------. 1402 | yyerrlab -- here on detecting error. | 1403 `--------------------------------------*/ 1404 yyerrlab: 1405 /* Make sure we have latest lookahead translation. See comments at 1406 user semantic actions for why this is necessary. */ 1407 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 1408 1409 /* If not already recovering from an error, report this error. */ 1410 if (!yyerrstatus) 1411 { 1412 ++yynerrs; 1413 #if ! YYERROR_VERBOSE 1414 yyerror (result, YY_("syntax error")); 1415 #else 1416 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1417 yyssp, yytoken) 1418 { 1419 char const *yymsgp = YY_("syntax error"); 1420 int yysyntax_error_status; 1421 yysyntax_error_status = YYSYNTAX_ERROR; 1422 if (yysyntax_error_status == 0) 1423 yymsgp = yymsg; 1424 else if (yysyntax_error_status == 1) 1425 { 1426 if (yymsg != yymsgbuf) 1427 YYSTACK_FREE (yymsg); 1428 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 1429 if (!yymsg) 1430 { 1431 yymsg = yymsgbuf; 1432 yymsg_alloc = sizeof yymsgbuf; 1433 yysyntax_error_status = 2; 1434 } 1435 else 1436 { 1437 yysyntax_error_status = YYSYNTAX_ERROR; 1438 yymsgp = yymsg; 1439 } 1440 } 1441 yyerror (result, yymsgp); 1442 if (yysyntax_error_status == 2) 1443 goto yyexhaustedlab; 1444 } 1445 # undef YYSYNTAX_ERROR 1446 #endif 1447 } 1448 1449 1450 1451 if (yyerrstatus == 3) 1452 { 1453 /* If just tried and failed to reuse lookahead token after an 1454 error, discard it. */ 1455 1456 if (yychar <= YYEOF) 1457 { 1458 /* Return failure if at end of input. */ 1459 if (yychar == YYEOF) 1460 YYABORT; 1461 } 1462 else 1463 { 1464 yydestruct ("Error: discarding", 1465 yytoken, &yylval, result); 1466 yychar = YYEMPTY; 1467 } 1468 } 1469 1470 /* Else will try to reuse lookahead token after shifting the error 1471 token. */ 1472 goto yyerrlab1; 1473 1474 1475 /*---------------------------------------------------. 1476 | yyerrorlab -- error raised explicitly by YYERROR. | 1477 `---------------------------------------------------*/ 1478 yyerrorlab: 1479 /* Pacify compilers when the user code never invokes YYERROR and the 1480 label yyerrorlab therefore never appears in user code. */ 1481 if (0) 1482 YYERROR; 1483 1484 /* Do not reclaim the symbols of the rule whose action triggered 1485 this YYERROR. */ 1486 YYPOPSTACK (yylen); 1487 yylen = 0; 1488 YY_STACK_PRINT (yyss, yyssp); 1489 yystate = *yyssp; 1490 goto yyerrlab1; 1491 1492 1493 /*-------------------------------------------------------------. 1494 | yyerrlab1 -- common code for both syntax error and YYERROR. | 1495 `-------------------------------------------------------------*/ 1496 yyerrlab1: 1497 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1498 1499 for (;;) 1500 { 1501 yyn = yypact[yystate]; 1502 if (!yypact_value_is_default (yyn)) 1503 { 1504 yyn += YYTERROR; 1505 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1506 { 1507 yyn = yytable[yyn]; 1508 if (0 < yyn) 1509 break; 1510 } 1511 } 1512 1513 /* Pop the current state because it cannot handle the error token. */ 1514 if (yyssp == yyss) 1515 YYABORT; 1516 1517 1518 yydestruct ("Error: popping", 1519 yystos[yystate], yyvsp, result); 1520 YYPOPSTACK (1); 1521 yystate = *yyssp; 1522 YY_STACK_PRINT (yyss, yyssp); 1523 } 1524 1525 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1526 *++yyvsp = yylval; 1527 YY_IGNORE_MAYBE_UNINITIALIZED_END 1528 1529 1530 /* Shift the error token. */ 1531 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 1532 1533 yystate = yyn; 1534 goto yynewstate; 1535 1536 1537 /*-------------------------------------. 1538 | yyacceptlab -- YYACCEPT comes here. | 1539 `-------------------------------------*/ 1540 yyacceptlab: 1541 yyresult = 0; 1542 goto yyreturn; 1543 1544 1545 /*-----------------------------------. 1546 | yyabortlab -- YYABORT comes here. | 1547 `-----------------------------------*/ 1548 yyabortlab: 1549 yyresult = 1; 1550 goto yyreturn; 1551 1552 1553 #if !defined yyoverflow || YYERROR_VERBOSE 1554 /*-------------------------------------------------. 1555 | yyexhaustedlab -- memory exhaustion comes here. | 1556 `-------------------------------------------------*/ 1557 yyexhaustedlab: 1558 yyerror (result, YY_("memory exhausted")); 1559 yyresult = 2; 1560 /* Fall through. */ 1561 #endif 1562 1563 1564 /*-----------------------------------------------------. 1565 | yyreturn -- parsing is finished, return the result. | 1566 `-----------------------------------------------------*/ 1567 yyreturn: 1568 if (yychar != YYEMPTY) 1569 { 1570 /* Make sure we have latest lookahead translation. See comments at 1571 user semantic actions for why this is necessary. */ 1572 yytoken = YYTRANSLATE (yychar); 1573 yydestruct ("Cleanup: discarding lookahead", 1574 yytoken, &yylval, result); 1575 } 1576 /* Do not reclaim the symbols of the rule whose action triggered 1577 this YYABORT or YYACCEPT. */ 1578 YYPOPSTACK (yylen); 1579 YY_STACK_PRINT (yyss, yyssp); 1580 while (yyssp != yyss) 1581 { 1582 yydestruct ("Cleanup: popping", 1583 yystos[*yyssp], yyvsp, result); 1584 YYPOPSTACK (1); 1585 } 1586 #ifndef yyoverflow 1587 if (yyss != yyssa) 1588 YYSTACK_FREE (yyss); 1589 #endif 1590 #if YYERROR_VERBOSE 1591 if (yymsg != yymsgbuf) 1592 YYSTACK_FREE (yymsg); 1593 #endif 1594 return yyresult; 1595 } 1596 #line 150 "segparse.y" /* yacc.c:1918 */ 1597 1598 1599 1600 static float 1601 seg_atof(const char *value) 1602 { 1603 Datum datum; 1604 1605 datum = DirectFunctionCall1(float4in, CStringGetDatum(value)); 1606 return DatumGetFloat4(datum); 1607 } 1608 1609 1610 #include "segscan.c" 1611