LCOV - code coverage report
Current view: top level - contrib/cube - cubeparse.c (source / functions) Hit Total Coverage
Test: PostgreSQL 13devel Lines: 75 129 58.1 %
Date: 2019-09-19 16:06:56 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13