LCOV - code coverage report
Current view: top level - contrib/pg_plan_advice - pgpa_parser.c (source / functions) Coverage Total Hit
Test: PostgreSQL 20devel Lines: 79.6 % 201 160
Test Date: 2026-07-25 22:15:46 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 67.8 % 115 78

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

Generated by: LCOV version 2.0-1