LCOV - code coverage report
Current view: top level - contrib/cube - cubeparse.c (source / functions) Hit Total Coverage
Test: PostgreSQL 15devel Lines: 95 154 61.7 %
Date: 2021-12-05 01:09:12 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14