LCOV - code coverage report
Current view: top level - contrib/pg_plan_advice - pgpa_parser.c (source / functions) Coverage Total Hit
Test: PostgreSQL 19devel Lines: 79.6 % 201 160
Test Date: 2026-03-16 00:15:06 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit

            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   78
     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,   119,   146,
     554              :      163,   168,   177,   185,   191,   192,   193,   194,   195,   203,
     555              :      205,   208,   212,   215,   218,   220,   223,   226,   235,   241,
     556              :      244,   246,   249,   253,   259,   267,   270
     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 (-28)
     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              :      -28,    10,    29,   -28,     0,     2,    11,    34,   -28,   -28,
     604              :      -28,   -28,   -28,     9,    43,    51,    35,   -28,   -28,   -28,
     605              :      -28,   -28,   -28,   -28,   -28,   -28,    39,   -28,   -28,    67,
     606              :      -28,   -28,   -28,   -28,   -28,   -28,    22,     1,    44,    46,
     607              :      -28,    49,    59,   -28,   -28,   -28,    64,    54,    67,   -28,
     608              :       65,    72,   -28,   -28,    74,   -28,   -28
     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              :      -28,   -28,   -28,   -28,   -13,   -28,   -28,   -27,   -28,   -28,
     628              :      -28,   -28,   -28,    56,   -28,    -2
     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              :       25,    29,    41,    34,    17,    18,    19,    20,    21,     9,
     644              :        3,    10,    17,    18,    19,    20,    21,    44,    22,    23,
     645              :       11,    53,    37,    25,    24,    17,    18,    19,    20,    21,
     646              :       42,    22,    43,     4,     5,     6,     7,    24,    17,    18,
     647              :       19,    20,    21,    12,    32,    33,    17,    18,    19,    20,
     648              :       21,    38,    45,    28,    17,    18,    19,    20,    21,    46,
     649              :       48,    30,    17,    18,    19,    20,    21,    50,    51,    49,
     650              :       17,    18,    19,    20,    21,    55,    54,    56,    36
     651              : };
     652              : 
     653              : static const yytype_int8 yycheck[] =
     654              : {
     655              :       13,    14,    29,    16,     3,     4,     5,     6,     7,     9,
     656              :        0,     9,     3,     4,     5,     6,     7,    16,     9,    10,
     657              :        9,    48,    24,    36,    15,     3,     4,     5,     6,     7,
     658              :       32,     9,    10,     4,     5,     6,     7,    15,     3,     4,
     659              :        5,     6,     7,     9,     9,    10,     3,     4,     5,     6,
     660              :        7,    12,     8,    10,     3,     4,     5,     6,     7,    13,
     661              :       11,    10,     3,     4,     5,     6,     7,     3,    14,    10,
     662              :        3,     4,     5,     6,     7,     3,    11,     3,    22
     663              : };
     664              : 
     665              : /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
     666              :    state STATE-NUM.  */
     667              : static const yytype_int8 yystos[] =
     668              : {
     669              :        0,    18,    19,     0,     4,     5,     6,     7,    20,     9,
     670              :        9,     9,     9,    30,    29,    32,    27,     3,     4,     5,
     671              :        6,     7,     9,    10,    15,    21,    24,    31,    10,    21,
     672              :       10,    21,     9,    10,    21,    28,    30,    32,    12,    23,
     673              :       22,    24,    32,    10,    16,     8,    13,    25,    11,    10,
     674              :        3,    14,    26,    24,    11,     3,     3
     675              : };
     676              : 
     677              : /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
     678              : static const yytype_int8 yyr1[] =
     679              : {
     680              :        0,    17,    18,    19,    19,    20,    20,    20,    20,    21,
     681              :       22,    22,    23,    23,    24,    24,    24,    24,    24,    25,
     682              :       25,    25,    26,    26,    27,    27,    27,    28,    29,    29,
     683              :       30,    30,    30,    31,    31,    32,    32
     684              : };
     685              : 
     686              : /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
     687              : static const yytype_int8 yyr2[] =
     688              : {
     689              :        0,     2,     1,     2,     0,     4,     4,     4,     4,     4,
     690              :        1,     3,     2,     0,     1,     1,     1,     1,     1,     4,
     691              :        2,     0,     2,     0,     2,     2,     0,     3,     3,     0,
     692              :        2,     2,     0,     3,     3,     2,     0
     693              : };
     694              : 
     695              : 
     696              : enum { YYENOMEM = -2 };
     697              : 
     698              : #define yyerrok         (yyerrstatus = 0)
     699              : #define yyclearin       (yychar = YYEMPTY)
     700              : 
     701              : #define YYACCEPT        goto yyacceptlab
     702              : #define YYABORT         goto yyabortlab
     703              : #define YYERROR         goto yyerrorlab
     704              : #define YYNOMEM         goto yyexhaustedlab
     705              : 
     706              : 
     707              : #define YYRECOVERING()  (!!yyerrstatus)
     708              : 
     709              : #define YYBACKUP(Token, Value)                                    \
     710              :   do                                                              \
     711              :     if (yychar == YYEMPTY)                                        \
     712              :       {                                                           \
     713              :         yychar = (Token);                                         \
     714              :         yylval = (Value);                                         \
     715              :         YYPOPSTACK (yylen);                                       \
     716              :         yystate = *yyssp;                                         \
     717              :         goto yybackup;                                            \
     718              :       }                                                           \
     719              :     else                                                          \
     720              :       {                                                           \
     721              :         yyerror (result, parse_error_msg_p, yyscanner, YY_("syntax error: cannot back up")); \
     722              :         YYERROR;                                                  \
     723              :       }                                                           \
     724              :   while (0)
     725              : 
     726              : /* Backward compatibility with an undocumented macro.
     727              :    Use YYerror or YYUNDEF. */
     728              : #define YYERRCODE YYUNDEF
     729              : 
     730              : 
     731              : /* Enable debugging if requested.  */
     732              : #if YYDEBUG
     733              : 
     734              : # ifndef YYFPRINTF
     735              : #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
     736              : #  define YYFPRINTF fprintf
     737              : # endif
     738              : 
     739              : # define YYDPRINTF(Args)                        \
     740              : do {                                            \
     741              :   if (yydebug)                                  \
     742              :     YYFPRINTF Args;                             \
     743              : } while (0)
     744              : 
     745              : 
     746              : 
     747              : 
     748              : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
     749              : do {                                                                      \
     750              :   if (yydebug)                                                            \
     751              :     {                                                                     \
     752              :       YYFPRINTF (stderr, "%s ", Title);                                   \
     753              :       yy_symbol_print (stderr,                                            \
     754              :                   Kind, Value, result, parse_error_msg_p, yyscanner); \
     755              :       YYFPRINTF (stderr, "\n");                                           \
     756              :     }                                                                     \
     757              : } while (0)
     758              : 
     759              : 
     760              : /*-----------------------------------.
     761              : | Print this symbol's value on YYO.  |
     762              : `-----------------------------------*/
     763              : 
     764              : static void
     765              : yy_symbol_value_print (FILE *yyo,
     766              :                        yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, List **result, char **parse_error_msg_p, yyscan_t yyscanner)
     767              : {
     768              :   FILE *yyoutput = yyo;
     769              :   YY_USE (yyoutput);
     770              :   YY_USE (result);
     771              :   YY_USE (parse_error_msg_p);
     772              :   YY_USE (yyscanner);
     773              :   if (!yyvaluep)
     774              :     return;
     775              :   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     776              :   YY_USE (yykind);
     777              :   YY_IGNORE_MAYBE_UNINITIALIZED_END
     778              : }
     779              : 
     780              : 
     781              : /*---------------------------.
     782              : | Print this symbol on YYO.  |
     783              : `---------------------------*/
     784              : 
     785              : static void
     786              : yy_symbol_print (FILE *yyo,
     787              :                  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, List **result, char **parse_error_msg_p, yyscan_t yyscanner)
     788              : {
     789              :   YYFPRINTF (yyo, "%s %s (",
     790              :              yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
     791              : 
     792              :   yy_symbol_value_print (yyo, yykind, yyvaluep, result, parse_error_msg_p, yyscanner);
     793              :   YYFPRINTF (yyo, ")");
     794              : }
     795              : 
     796              : /*------------------------------------------------------------------.
     797              : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
     798              : | TOP (included).                                                   |
     799              : `------------------------------------------------------------------*/
     800              : 
     801              : static void
     802              : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
     803              : {
     804              :   YYFPRINTF (stderr, "Stack now");
     805              :   for (; yybottom <= yytop; yybottom++)
     806              :     {
     807              :       int yybot = *yybottom;
     808              :       YYFPRINTF (stderr, " %d", yybot);
     809              :     }
     810              :   YYFPRINTF (stderr, "\n");
     811              : }
     812              : 
     813              : # define YY_STACK_PRINT(Bottom, Top)                            \
     814              : do {                                                            \
     815              :   if (yydebug)                                                  \
     816              :     yy_stack_print ((Bottom), (Top));                           \
     817              : } while (0)
     818              : 
     819              : 
     820              : /*------------------------------------------------.
     821              : | Report that the YYRULE is going to be reduced.  |
     822              : `------------------------------------------------*/
     823              : 
     824              : static void
     825              : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
     826              :                  int yyrule, List **result, char **parse_error_msg_p, yyscan_t yyscanner)
     827              : {
     828              :   int yylno = yyrline[yyrule];
     829              :   int yynrhs = yyr2[yyrule];
     830              :   int yyi;
     831              :   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
     832              :              yyrule - 1, yylno);
     833              :   /* The symbols being reduced.  */
     834              :   for (yyi = 0; yyi < yynrhs; yyi++)
     835              :     {
     836              :       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
     837              :       yy_symbol_print (stderr,
     838              :                        YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
     839              :                        &yyvsp[(yyi + 1) - (yynrhs)], result, parse_error_msg_p, yyscanner);
     840              :       YYFPRINTF (stderr, "\n");
     841              :     }
     842              : }
     843              : 
     844              : # define YY_REDUCE_PRINT(Rule)          \
     845              : do {                                    \
     846              :   if (yydebug)                          \
     847              :     yy_reduce_print (yyssp, yyvsp, Rule, result, parse_error_msg_p, yyscanner); \
     848              : } while (0)
     849              : 
     850              : /* Nonzero means print parse trace.  It is left uninitialized so that
     851              :    multiple parsers can coexist.  */
     852              : int yydebug;
     853              : #else /* !YYDEBUG */
     854              : # define YYDPRINTF(Args) ((void) 0)
     855              : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
     856              : # define YY_STACK_PRINT(Bottom, Top)
     857              : # define YY_REDUCE_PRINT(Rule)
     858              : #endif /* !YYDEBUG */
     859              : 
     860              : 
     861              : /* YYINITDEPTH -- initial size of the parser's stacks.  */
     862              : #ifndef YYINITDEPTH
     863              : # define YYINITDEPTH 200
     864              : #endif
     865              : 
     866              : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
     867              :    if the built-in stack extension method is used).
     868              : 
     869              :    Do not make this value too large; the results are undefined if
     870              :    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
     871              :    evaluated with infinite-precision integer arithmetic.  */
     872              : 
     873              : #ifndef YYMAXDEPTH
     874              : # define YYMAXDEPTH 10000
     875              : #endif
     876              : 
     877              : 
     878              : 
     879              : 
     880              : 
     881              : 
     882              : /*-----------------------------------------------.
     883              : | Release the memory associated to this symbol.  |
     884              : `-----------------------------------------------*/
     885              : 
     886              : static void
     887          507 : yydestruct (const char *yymsg,
     888              :             yysymbol_kind_t yykind, YYSTYPE *yyvaluep, List **result, char **parse_error_msg_p, yyscan_t yyscanner)
     889              : {
     890              :   YY_USE (yyvaluep);
     891              :   YY_USE (result);
     892              :   YY_USE (parse_error_msg_p);
     893              :   YY_USE (yyscanner);
     894          507 :   if (!yymsg)
     895            0 :     yymsg = "Deleting";
     896              :   YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
     897              : 
     898              :   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     899              :   YY_USE (yykind);
     900              :   YY_IGNORE_MAYBE_UNINITIALIZED_END
     901          507 : }
     902              : 
     903              : 
     904              : 
     905              : 
     906              : 
     907              : 
     908              : /*----------.
     909              : | yyparse.  |
     910              : `----------*/
     911              : 
     912              : int
     913          243 : yyparse (List **result, char **parse_error_msg_p, yyscan_t yyscanner)
     914              : {
     915              : /* Lookahead token kind.  */
     916              : int yychar;
     917              : 
     918              : 
     919              : /* The semantic value of the lookahead symbol.  */
     920              : /* Default value used for initialization, for pacifying older GCCs
     921              :    or non-GCC compilers.  */
     922              : YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
     923              : YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
     924              : 
     925              :     /* Number of syntax errors so far.  */
     926          243 :     int yynerrs = 0;
     927              : 
     928          243 :     yy_state_fast_t yystate = 0;
     929              :     /* Number of tokens to shift before error messages enabled.  */
     930          243 :     int yyerrstatus = 0;
     931              : 
     932              :     /* Refer to the stacks through separate pointers, to allow yyoverflow
     933              :        to reallocate them elsewhere.  */
     934              : 
     935              :     /* Their size.  */
     936          243 :     YYPTRDIFF_T yystacksize = YYINITDEPTH;
     937              : 
     938              :     /* The state stack: array, bottom, top.  */
     939              :     yy_state_t yyssa[YYINITDEPTH];
     940          243 :     yy_state_t *yyss = yyssa;
     941          243 :     yy_state_t *yyssp = yyss;
     942              : 
     943              :     /* The semantic value stack: array, bottom, top.  */
     944              :     YYSTYPE yyvsa[YYINITDEPTH];
     945          243 :     YYSTYPE *yyvs = yyvsa;
     946          243 :     YYSTYPE *yyvsp = yyvs;
     947              : 
     948              :   int yyn;
     949              :   /* The return value of yyparse.  */
     950              :   int yyresult;
     951              :   /* Lookahead symbol kind.  */
     952          243 :   yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
     953              :   /* The variables used to return semantic value and location from the
     954              :      action routines.  */
     955              :   YYSTYPE yyval;
     956              : 
     957              : 
     958              : 
     959              : #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
     960              : 
     961              :   /* The number of symbols on the RHS of the reduced rule.
     962              :      Keep to zero when no symbol should be popped.  */
     963          243 :   int yylen = 0;
     964              : 
     965              :   YYDPRINTF ((stderr, "Starting parse\n"));
     966              : 
     967          243 :   yychar = YYEMPTY; /* Cause a token to be read.  */
     968              : 
     969          243 :   goto yysetstate;
     970              : 
     971              : 
     972              : /*------------------------------------------------------------.
     973              : | yynewstate -- push a new state, which is found in yystate.  |
     974              : `------------------------------------------------------------*/
     975         5005 : yynewstate:
     976              :   /* In all cases, when you get here, the value and location stacks
     977              :      have just been pushed.  So pushing a state here evens the stacks.  */
     978         5005 :   yyssp++;
     979              : 
     980              : 
     981              : /*--------------------------------------------------------------------.
     982              : | yysetstate -- set current state (the top of the stack) to yystate.  |
     983              : `--------------------------------------------------------------------*/
     984         5248 : yysetstate:
     985              :   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
     986              :   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
     987              :   YY_IGNORE_USELESS_CAST_BEGIN
     988         5248 :   *yyssp = YY_CAST (yy_state_t, yystate);
     989              :   YY_IGNORE_USELESS_CAST_END
     990              :   YY_STACK_PRINT (yyss, yyssp);
     991              : 
     992         5248 :   if (yyss + yystacksize - 1 <= yyssp)
     993              : #if !defined yyoverflow && !defined YYSTACK_RELOCATE
     994              :     YYNOMEM;
     995              : #else
     996              :     {
     997              :       /* Get the current used size of the three stacks, in elements.  */
     998            0 :       YYPTRDIFF_T yysize = yyssp - yyss + 1;
     999              : 
    1000              : # if defined yyoverflow
    1001              :       {
    1002              :         /* Give user a chance to reallocate the stack.  Use copies of
    1003              :            these so that the &'s don't force the real ones into
    1004              :            memory.  */
    1005              :         yy_state_t *yyss1 = yyss;
    1006              :         YYSTYPE *yyvs1 = yyvs;
    1007              : 
    1008              :         /* Each stack pointer address is followed by the size of the
    1009              :            data in use in that stack, in bytes.  This used to be a
    1010              :            conditional around just the two extra args, but that might
    1011              :            be undefined if yyoverflow is a macro.  */
    1012              :         yyoverflow (YY_("memory exhausted"),
    1013              :                     &yyss1, yysize * YYSIZEOF (*yyssp),
    1014              :                     &yyvs1, yysize * YYSIZEOF (*yyvsp),
    1015              :                     &yystacksize);
    1016              :         yyss = yyss1;
    1017              :         yyvs = yyvs1;
    1018              :       }
    1019              : # else /* defined YYSTACK_RELOCATE */
    1020              :       /* Extend the stack our own way.  */
    1021            0 :       if (YYMAXDEPTH <= yystacksize)
    1022            0 :         YYNOMEM;
    1023            0 :       yystacksize *= 2;
    1024            0 :       if (YYMAXDEPTH < yystacksize)
    1025            0 :         yystacksize = YYMAXDEPTH;
    1026              : 
    1027              :       {
    1028            0 :         yy_state_t *yyss1 = yyss;
    1029              :         union yyalloc *yyptr =
    1030            0 :           YY_CAST (union yyalloc *,
    1031              :                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
    1032            0 :         if (! yyptr)
    1033            0 :           YYNOMEM;
    1034            0 :         YYSTACK_RELOCATE (yyss_alloc, yyss);
    1035            0 :         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
    1036              : #  undef YYSTACK_RELOCATE
    1037            0 :         if (yyss1 != yyssa)
    1038            0 :           YYSTACK_FREE (yyss1);
    1039              :       }
    1040              : # endif
    1041              : 
    1042            0 :       yyssp = yyss + yysize - 1;
    1043            0 :       yyvsp = yyvs + yysize - 1;
    1044              : 
    1045              :       YY_IGNORE_USELESS_CAST_BEGIN
    1046              :       YYDPRINTF ((stderr, "Stack size increased to %ld\n",
    1047              :                   YY_CAST (long, yystacksize)));
    1048              :       YY_IGNORE_USELESS_CAST_END
    1049              : 
    1050            0 :       if (yyss + yystacksize - 1 <= yyssp)
    1051            0 :         YYABORT;
    1052              :     }
    1053              : #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
    1054              : 
    1055              : 
    1056         5248 :   if (yystate == YYFINAL)
    1057          232 :     YYACCEPT;
    1058              : 
    1059         5016 :   goto yybackup;
    1060              : 
    1061              : 
    1062              : /*-----------.
    1063              : | yybackup.  |
    1064              : `-----------*/
    1065         5016 : yybackup:
    1066              :   /* Do appropriate processing given the current state.  Read a
    1067              :      lookahead token if we need one and don't already have one.  */
    1068              : 
    1069              :   /* First try to decide what to do without reference to lookahead token.  */
    1070         5016 :   yyn = yypact[yystate];
    1071         5016 :   if (yypact_value_is_default (yyn))
    1072         2189 :     goto yydefault;
    1073              : 
    1074              :   /* Not known => get a lookahead token if don't already have one.  */
    1075              : 
    1076              :   /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
    1077         2827 :   if (yychar == YYEMPTY)
    1078              :     {
    1079              :       YYDPRINTF ((stderr, "Reading a token\n"));
    1080         1573 :       yychar = yylex (&yylval, result, parse_error_msg_p, yyscanner);
    1081              :     }
    1082              : 
    1083         2827 :   if (yychar <= YYEOF)
    1084              :     {
    1085          471 :       yychar = YYEOF;
    1086          471 :       yytoken = YYSYMBOL_YYEOF;
    1087              :       YYDPRINTF ((stderr, "Now at end of input.\n"));
    1088              :     }
    1089         2356 :   else if (yychar == YYerror)
    1090              :     {
    1091              :       /* The scanner already issued an error message, process directly
    1092              :          to error recovery.  But do not keep the error token as
    1093              :          lookahead, it is too special and may lead us to an endless
    1094              :          loop in error recovery. */
    1095            0 :       yychar = YYUNDEF;
    1096            0 :       yytoken = YYSYMBOL_YYerror;
    1097            0 :       goto yyerrlab1;
    1098              :     }
    1099              :   else
    1100              :     {
    1101         2356 :       yytoken = YYTRANSLATE (yychar);
    1102              :       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    1103              :     }
    1104              : 
    1105              :   /* If the proper action on seeing token YYTOKEN is to reduce or to
    1106              :      detect an error, take that action.  */
    1107         2827 :   yyn += yytoken;
    1108         2827 :   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    1109         1265 :     goto yydefault;
    1110         1562 :   yyn = yytable[yyn];
    1111         1562 :   if (yyn <= 0)
    1112              :     {
    1113              :       if (yytable_value_is_error (yyn))
    1114              :         goto yyerrlab;
    1115            0 :       yyn = -yyn;
    1116            0 :       goto yyreduce;
    1117              :     }
    1118              : 
    1119              :   /* Count tokens shifted since error; after three, turn off error
    1120              :      status.  */
    1121         1562 :   if (yyerrstatus)
    1122            0 :     yyerrstatus--;
    1123              : 
    1124              :   /* Shift the lookahead token.  */
    1125              :   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
    1126         1562 :   yystate = yyn;
    1127              :   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
    1128         1562 :   *++yyvsp = yylval;
    1129              :   YY_IGNORE_MAYBE_UNINITIALIZED_END
    1130              : 
    1131              :   /* Discard the shifted token.  */
    1132         1562 :   yychar = YYEMPTY;
    1133         1562 :   goto yynewstate;
    1134              : 
    1135              : 
    1136              : /*-----------------------------------------------------------.
    1137              : | yydefault -- do the default action for the current state.  |
    1138              : `-----------------------------------------------------------*/
    1139         3454 : yydefault:
    1140         3454 :   yyn = yydefact[yystate];
    1141         3454 :   if (yyn == 0)
    1142           11 :     goto yyerrlab;
    1143         3443 :   goto yyreduce;
    1144              : 
    1145              : 
    1146              : /*-----------------------------.
    1147              : | yyreduce -- do a reduction.  |
    1148              : `-----------------------------*/
    1149         3443 : yyreduce:
    1150              :   /* yyn is the number of a rule to reduce with.  */
    1151         3443 :   yylen = yyr2[yyn];
    1152              : 
    1153              :   /* If YYLEN is nonzero, implement the default value of the action:
    1154              :      '$$ = $1'.
    1155              : 
    1156              :      Otherwise, the following line sets YYVAL to garbage.
    1157              :      This behavior is undocumented and Bison
    1158              :      users should not rely upon it.  Assigning to YYVAL
    1159              :      unconditionally makes the parser a bit smaller, and it avoids a
    1160              :      GCC warning that YYVAL may be used uninitialized.  */
    1161         3443 :   yyval = yyvsp[1-yylen];
    1162              : 
    1163              : 
    1164              :   YY_REDUCE_PRINT (yyn);
    1165         3443 :   switch (yyn)
    1166              :     {
    1167          236 :   case 2: /* parse_toplevel: advice_item_list  */
    1168              : #line 72 "pgpa_parser.y"
    1169              :                 {
    1170              :             (void) yynerrs;             /* suppress compiler warning */
    1171              :             *result = (yyvsp[0].list);
    1172              :         }
    1173              : #line 1174 "pgpa_parser.c"
    1174          236 :     break;
    1175              : 
    1176          250 :   case 3: /* advice_item_list: advice_item_list advice_item  */
    1177              : #line 79 "pgpa_parser.y"
    1178              :                 { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].item)); }
    1179              : #line 1180 "pgpa_parser.c"
    1180          250 :     break;
    1181              : 
    1182          243 :   case 4: /* advice_item_list: %empty  */
    1183              : #line 81 "pgpa_parser.y"
    1184              :                 { (yyval.list) = NIL; }
    1185              : #line 1186 "pgpa_parser.c"
    1186          243 :     break;
    1187              : 
    1188           40 :   case 5: /* advice_item: TOK_TAG_JOIN_ORDER '(' join_order_target_list ')'  */
    1189              : #line 85 "pgpa_parser.y"
    1190              :                 {
    1191              :             (yyval.item) = palloc0_object(pgpa_advice_item);
    1192              :             (yyval.item)->tag = PGPA_TAG_JOIN_ORDER;
    1193              :             (yyval.item)->targets = (yyvsp[-1].list);
    1194              :             if ((yyvsp[-1].list) == NIL)
    1195              :                 pgpa_yyerror(result, parse_error_msg_p, yyscanner,
    1196              :                              "JOIN_ORDER must have at least one target");
    1197              :         }
    1198              : #line 1199 "pgpa_parser.c"
    1199           40 :     break;
    1200              : 
    1201           38 :   case 6: /* advice_item: TOK_TAG_INDEX '(' index_target_list ')'  */
    1202              : #line 94 "pgpa_parser.y"
    1203              :                 {
    1204              :             (yyval.item) = palloc0_object(pgpa_advice_item);
    1205              :             if (strcmp((yyvsp[-3].str), "index_only_scan") == 0)
    1206              :                 (yyval.item)->tag = PGPA_TAG_INDEX_ONLY_SCAN;
    1207              :             else if (strcmp((yyvsp[-3].str), "index_scan") == 0)
    1208              :                 (yyval.item)->tag = PGPA_TAG_INDEX_SCAN;
    1209              :             else
    1210              :                 elog(ERROR, "tag parsing failed: %s", (yyvsp[-3].str));
    1211              :             (yyval.item)->targets = (yyvsp[-1].list);
    1212              :         }
    1213              : #line 1214 "pgpa_parser.c"
    1214           38 :     break;
    1215              : 
    1216           70 :   case 7: /* advice_item: TOK_TAG_SIMPLE '(' simple_target_list ')'  */
    1217              : #line 105 "pgpa_parser.y"
    1218              :                 {
    1219              :             (yyval.item) = palloc0_object(pgpa_advice_item);
    1220              :             if (strcmp((yyvsp[-3].str), "bitmap_heap_scan") == 0)
    1221              :                 (yyval.item)->tag = PGPA_TAG_BITMAP_HEAP_SCAN;
    1222              :             else if (strcmp((yyvsp[-3].str), "no_gather") == 0)
    1223              :                 (yyval.item)->tag = PGPA_TAG_NO_GATHER;
    1224              :             else if (strcmp((yyvsp[-3].str), "seq_scan") == 0)
    1225              :                 (yyval.item)->tag = PGPA_TAG_SEQ_SCAN;
    1226              :             else if (strcmp((yyvsp[-3].str), "tid_scan") == 0)
    1227              :                 (yyval.item)->tag = PGPA_TAG_TID_SCAN;
    1228              :             else
    1229              :                 elog(ERROR, "tag parsing failed: %s", (yyvsp[-3].str));
    1230              :             (yyval.item)->targets = (yyvsp[-1].list);
    1231              :         }
    1232              : #line 1233 "pgpa_parser.c"
    1233           70 :     break;
    1234              : 
    1235          102 :   case 8: /* advice_item: TOK_TAG_GENERIC '(' generic_target_list ')'  */
    1236              : #line 120 "pgpa_parser.y"
    1237              :                 {
    1238              :             bool    fail;
    1239              : 
    1240              :             (yyval.item) = palloc0_object(pgpa_advice_item);
    1241              :             (yyval.item)->tag = pgpa_parse_advice_tag((yyvsp[-3].str), &fail);
    1242              :             if (fail)
    1243              :             {
    1244              :                 pgpa_yyerror(result, parse_error_msg_p, yyscanner,
    1245              :                              "unrecognized advice tag");
    1246              :             }
    1247              : 
    1248              :             if ((yyval.item)->tag == PGPA_TAG_FOREIGN_JOIN)
    1249              :             {
    1250              :                 foreach_ptr(pgpa_advice_target, target, (yyvsp[-1].list))
    1251              :                 {
    1252              :                     if (target->ttype == PGPA_TARGET_IDENTIFIER ||
    1253              :                         list_length(target->children) == 1)
    1254              :                             pgpa_yyerror(result, parse_error_msg_p, yyscanner,
    1255              :                                          "FOREIGN_JOIN targets must contain more than one relation identifier");
    1256              :                 }
    1257              :             }
    1258              : 
    1259              :             (yyval.item)->targets = (yyvsp[-1].list);
    1260              :         }
    1261              : #line 1262 "pgpa_parser.c"
    1262          102 :     break;
    1263              : 
    1264          338 :   case 9: /* relation_identifier: identifier opt_ri_occurrence opt_partition opt_plan_name  */
    1265              : #line 147 "pgpa_parser.y"
    1266              :                 {
    1267              :             (yyval.target) = palloc0_object(pgpa_advice_target);
    1268              :             (yyval.target)->ttype = PGPA_TARGET_IDENTIFIER;
    1269              :             (yyval.target)->rid.alias_name = (yyvsp[-3].str);
    1270              :             (yyval.target)->rid.occurrence = (yyvsp[-2].integer);
    1271              :             if (list_length((yyvsp[-1].list)) == 2)
    1272              :             {
    1273              :                 (yyval.target)->rid.partnsp = linitial((yyvsp[-1].list));
    1274              :                 (yyval.target)->rid.partrel = lsecond((yyvsp[-1].list));
    1275              :             }
    1276              :             else if ((yyvsp[-1].list) != NIL)
    1277              :                 (yyval.target)->rid.partrel = linitial((yyvsp[-1].list));
    1278              :             (yyval.target)->rid.plan_name = (yyvsp[0].str);
    1279              :         }
    1280              : #line 1281 "pgpa_parser.c"
    1281          338 :     break;
    1282              : 
    1283           34 :   case 10: /* index_name: identifier  */
    1284              : #line 164 "pgpa_parser.y"
    1285              :                 {
    1286              :             (yyval.itarget) = palloc0_object(pgpa_index_target);
    1287              :             (yyval.itarget)->indname = (yyvsp[0].str);
    1288              :         }
    1289              : #line 1290 "pgpa_parser.c"
    1290           34 :     break;
    1291              : 
    1292            8 :   case 11: /* index_name: identifier '.' identifier  */
    1293              : #line 169 "pgpa_parser.y"
    1294              :                 {
    1295              :             (yyval.itarget) = palloc0_object(pgpa_index_target);
    1296              :             (yyval.itarget)->indnamespace = (yyvsp[-2].str);
    1297              :             (yyval.itarget)->indname = (yyvsp[0].str);
    1298              :         }
    1299              : #line 1300 "pgpa_parser.c"
    1300            8 :     break;
    1301              : 
    1302            8 :   case 12: /* opt_ri_occurrence: '#' TOK_INTEGER  */
    1303              : #line 178 "pgpa_parser.y"
    1304              :                 {
    1305              :             if ((yyvsp[0].integer) <= 0)
    1306              :                 pgpa_yyerror(result, parse_error_msg_p, yyscanner,
    1307              :                              "only positive occurrence numbers are permitted");
    1308              :             (yyval.integer) = (yyvsp[0].integer);
    1309              :         }
    1310              : #line 1311 "pgpa_parser.c"
    1311            8 :     break;
    1312              : 
    1313          330 :   case 13: /* opt_ri_occurrence: %empty  */
    1314              : #line 185 "pgpa_parser.y"
    1315              :                 {
    1316              :             /* The default occurrence number is 1. */
    1317              :             (yyval.integer) = 1;
    1318              :         }
    1319              : #line 1320 "pgpa_parser.c"
    1320          330 :     break;
    1321              : 
    1322           12 :   case 19: /* opt_partition: '/' TOK_IDENT '.' TOK_IDENT  */
    1323              : #line 204 "pgpa_parser.y"
    1324              :                 { (yyval.list) = list_make2((yyvsp[-2].str), (yyvsp[0].str)); }
    1325              : #line 1326 "pgpa_parser.c"
    1326           12 :     break;
    1327              : 
    1328           14 :   case 20: /* opt_partition: '/' TOK_IDENT  */
    1329              : #line 206 "pgpa_parser.y"
    1330              :                 { (yyval.list) = list_make1((yyvsp[0].str)); }
    1331              : #line 1332 "pgpa_parser.c"
    1332           14 :     break;
    1333              : 
    1334          312 :   case 21: /* opt_partition: %empty  */
    1335              : #line 208 "pgpa_parser.y"
    1336              :                 { (yyval.list) = NIL; }
    1337              : #line 1338 "pgpa_parser.c"
    1338          312 :     break;
    1339              : 
    1340           10 :   case 22: /* opt_plan_name: '@' TOK_IDENT  */
    1341              : #line 213 "pgpa_parser.y"
    1342              :                 { (yyval.str) = (yyvsp[0].str); }
    1343              : #line 1344 "pgpa_parser.c"
    1344           10 :     break;
    1345              : 
    1346          328 :   case 23: /* opt_plan_name: %empty  */
    1347              : #line 215 "pgpa_parser.y"
    1348              :                 { (yyval.str) = NULL; }
    1349              : #line 1350 "pgpa_parser.c"
    1350          328 :     break;
    1351              : 
    1352           91 :   case 24: /* generic_target_list: generic_target_list relation_identifier  */
    1353              : #line 219 "pgpa_parser.y"
    1354              :                 { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].target)); }
    1355              : #line 1356 "pgpa_parser.c"
    1356           91 :     break;
    1357              : 
    1358           23 :   case 25: /* generic_target_list: generic_target_list generic_sublist  */
    1359              : #line 221 "pgpa_parser.y"
    1360              :                 { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].target)); }
    1361              : #line 1362 "pgpa_parser.c"
    1362           23 :     break;
    1363              : 
    1364          103 :   case 26: /* generic_target_list: %empty  */
    1365              : #line 223 "pgpa_parser.y"
    1366              :                 { (yyval.list) = NIL; }
    1367              : #line 1368 "pgpa_parser.c"
    1368          103 :     break;
    1369              : 
    1370           23 :   case 27: /* generic_sublist: '(' simple_target_list ')'  */
    1371              : #line 227 "pgpa_parser.y"
    1372              :                 {
    1373              :             (yyval.target) = palloc0_object(pgpa_advice_target);
    1374              :             (yyval.target)->ttype = PGPA_TARGET_ORDERED_LIST;
    1375              :             (yyval.target)->children = (yyvsp[-1].list);
    1376              :         }
    1377              : #line 1378 "pgpa_parser.c"
    1378           23 :     break;
    1379              : 
    1380           42 :   case 28: /* index_target_list: index_target_list relation_identifier index_name  */
    1381              : #line 236 "pgpa_parser.y"
    1382              :                 {
    1383              :             (yyvsp[-1].target)->itarget = (yyvsp[0].itarget);
    1384              :             (yyval.list) = lappend((yyvsp[-2].list), (yyvsp[-1].target));
    1385              :         }
    1386              : #line 1387 "pgpa_parser.c"
    1387           42 :     break;
    1388              : 
    1389           38 :   case 29: /* index_target_list: %empty  */
    1390              : #line 241 "pgpa_parser.y"
    1391              :                 { (yyval.list) = NIL; }
    1392              : #line 1393 "pgpa_parser.c"
    1393           38 :     break;
    1394              : 
    1395           85 :   case 30: /* join_order_target_list: join_order_target_list relation_identifier  */
    1396              : #line 245 "pgpa_parser.y"
    1397              :                 { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].target)); }
    1398              : #line 1399 "pgpa_parser.c"
    1399           85 :     break;
    1400              : 
    1401            6 :   case 31: /* join_order_target_list: join_order_target_list join_order_sublist  */
    1402              : #line 247 "pgpa_parser.y"
    1403              :                 { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].target)); }
    1404              : #line 1405 "pgpa_parser.c"
    1405            6 :     break;
    1406              : 
    1407           44 :   case 32: /* join_order_target_list: %empty  */
    1408              : #line 249 "pgpa_parser.y"
    1409              :                 { (yyval.list) = NIL; }
    1410              : #line 1411 "pgpa_parser.c"
    1411           44 :     break;
    1412              : 
    1413            4 :   case 33: /* join_order_sublist: '(' join_order_target_list ')'  */
    1414              : #line 254 "pgpa_parser.y"
    1415              :                 {
    1416              :             (yyval.target) = palloc0_object(pgpa_advice_target);
    1417              :             (yyval.target)->ttype = PGPA_TARGET_ORDERED_LIST;
    1418              :             (yyval.target)->children = (yyvsp[-1].list);
    1419              :         }
    1420              : #line 1421 "pgpa_parser.c"
    1421            4 :     break;
    1422              : 
    1423            2 :   case 34: /* join_order_sublist: '{' simple_target_list '}'  */
    1424              : #line 260 "pgpa_parser.y"
    1425              :                 {
    1426              :             (yyval.target) = palloc0_object(pgpa_advice_target);
    1427              :             (yyval.target)->ttype = PGPA_TARGET_UNORDERED_LIST;
    1428              :             (yyval.target)->children = (yyvsp[-1].list);
    1429              :         }
    1430              : #line 1431 "pgpa_parser.c"
    1431            2 :     break;
    1432              : 
    1433          120 :   case 35: /* simple_target_list: simple_target_list relation_identifier  */
    1434              : #line 268 "pgpa_parser.y"
    1435              :                 { (yyval.list) = lappend((yyvsp[-1].list), (yyvsp[0].target)); }
    1436              : #line 1437 "pgpa_parser.c"
    1437          120 :     break;
    1438              : 
    1439          101 :   case 36: /* simple_target_list: %empty  */
    1440              : #line 270 "pgpa_parser.y"
    1441              :                 { (yyval.list) = NIL; }
    1442              : #line 1443 "pgpa_parser.c"
    1443          101 :     break;
    1444              : 
    1445              : 
    1446              : #line 1447 "pgpa_parser.c"
    1447              : 
    1448          388 :       default: break;
    1449              :     }
    1450              :   /* User semantic actions sometimes alter yychar, and that requires
    1451              :      that yytoken be updated with the new translation.  We take the
    1452              :      approach of translating immediately before every use of yytoken.
    1453              :      One alternative is translating here after every semantic action,
    1454              :      but that translation would be missed if the semantic action invokes
    1455              :      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
    1456              :      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
    1457              :      incorrect destructor might then be invoked immediately.  In the
    1458              :      case of YYERROR or YYBACKUP, subsequent parser actions might lead
    1459              :      to an incorrect destructor call or verbose syntax error message
    1460              :      before the lookahead is translated.  */
    1461              :   YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
    1462              : 
    1463         3443 :   YYPOPSTACK (yylen);
    1464         3443 :   yylen = 0;
    1465              : 
    1466         3443 :   *++yyvsp = yyval;
    1467              : 
    1468              :   /* Now 'shift' the result of the reduction.  Determine what state
    1469              :      that goes to, based on the state we popped back to and the rule
    1470              :      number reduced by.  */
    1471              :   {
    1472         3443 :     const int yylhs = yyr1[yyn] - YYNTOKENS;
    1473         3443 :     const int yyi = yypgoto[yylhs] + *yyssp;
    1474         1519 :     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
    1475          355 :                ? yytable[yyi]
    1476         4962 :                : yydefgoto[yylhs]);
    1477              :   }
    1478              : 
    1479         3443 :   goto yynewstate;
    1480              : 
    1481              : 
    1482              : /*--------------------------------------.
    1483              : | yyerrlab -- here on detecting error.  |
    1484              : `--------------------------------------*/
    1485           11 : yyerrlab:
    1486              :   /* Make sure we have latest lookahead translation.  See comments at
    1487              :      user semantic actions for why this is necessary.  */
    1488           11 :   yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
    1489              :   /* If not already recovering from an error, report this error.  */
    1490           11 :   if (!yyerrstatus)
    1491              :     {
    1492           11 :       ++yynerrs;
    1493           11 :       yyerror (result, parse_error_msg_p, yyscanner, YY_("syntax error"));
    1494              :     }
    1495              : 
    1496           11 :   if (yyerrstatus == 3)
    1497              :     {
    1498              :       /* If just tried and failed to reuse lookahead token after an
    1499              :          error, discard it.  */
    1500              : 
    1501            0 :       if (yychar <= YYEOF)
    1502              :         {
    1503              :           /* Return failure if at end of input.  */
    1504            0 :           if (yychar == YYEOF)
    1505            0 :             YYABORT;
    1506              :         }
    1507              :       else
    1508              :         {
    1509            0 :           yydestruct ("Error: discarding",
    1510              :                       yytoken, &yylval, result, parse_error_msg_p, yyscanner);
    1511            0 :           yychar = YYEMPTY;
    1512              :         }
    1513              :     }
    1514              : 
    1515              :   /* Else will try to reuse lookahead token after shifting the error
    1516              :      token.  */
    1517           11 :   goto yyerrlab1;
    1518              : 
    1519              : 
    1520              : /*---------------------------------------------------.
    1521              : | yyerrorlab -- error raised explicitly by YYERROR.  |
    1522              : `---------------------------------------------------*/
    1523              : yyerrorlab:
    1524              :   /* Pacify compilers when the user code never invokes YYERROR and the
    1525              :      label yyerrorlab therefore never appears in user code.  */
    1526              :   if (0)
    1527              :     YYERROR;
    1528              :   ++yynerrs;
    1529              : 
    1530              :   /* Do not reclaim the symbols of the rule whose action triggered
    1531              :      this YYERROR.  */
    1532              :   YYPOPSTACK (yylen);
    1533              :   yylen = 0;
    1534              :   YY_STACK_PRINT (yyss, yyssp);
    1535              :   yystate = *yyssp;
    1536              :   goto yyerrlab1;
    1537              : 
    1538              : 
    1539              : /*-------------------------------------------------------------.
    1540              : | yyerrlab1 -- common code for both syntax error and YYERROR.  |
    1541              : `-------------------------------------------------------------*/
    1542           11 : yyerrlab1:
    1543           11 :   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
    1544              : 
    1545              :   /* Pop stack until we find a state that shifts the error token.  */
    1546              :   for (;;)
    1547              :     {
    1548           43 :       yyn = yypact[yystate];
    1549           43 :       if (!yypact_value_is_default (yyn))
    1550              :         {
    1551           25 :           yyn += YYSYMBOL_YYerror;
    1552           25 :           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
    1553              :             {
    1554            0 :               yyn = yytable[yyn];
    1555            0 :               if (0 < yyn)
    1556            0 :                 break;
    1557              :             }
    1558              :         }
    1559              : 
    1560              :       /* Pop the current state because it cannot handle the error token.  */
    1561           43 :       if (yyssp == yyss)
    1562           11 :         YYABORT;
    1563              : 
    1564              : 
    1565           32 :       yydestruct ("Error: popping",
    1566           32 :                   YY_ACCESSING_SYMBOL (yystate), yyvsp, result, parse_error_msg_p, yyscanner);
    1567           32 :       YYPOPSTACK (1);
    1568           32 :       yystate = *yyssp;
    1569              :       YY_STACK_PRINT (yyss, yyssp);
    1570              :     }
    1571              : 
    1572              :   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
    1573            0 :   *++yyvsp = yylval;
    1574              :   YY_IGNORE_MAYBE_UNINITIALIZED_END
    1575              : 
    1576              : 
    1577              :   /* Shift the error token.  */
    1578              :   YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
    1579              : 
    1580            0 :   yystate = yyn;
    1581            0 :   goto yynewstate;
    1582              : 
    1583              : 
    1584              : /*-------------------------------------.
    1585              : | yyacceptlab -- YYACCEPT comes here.  |
    1586              : `-------------------------------------*/
    1587          232 : yyacceptlab:
    1588          232 :   yyresult = 0;
    1589          232 :   goto yyreturnlab;
    1590              : 
    1591              : 
    1592              : /*-----------------------------------.
    1593              : | yyabortlab -- YYABORT comes here.  |
    1594              : `-----------------------------------*/
    1595           11 : yyabortlab:
    1596           11 :   yyresult = 1;
    1597           11 :   goto yyreturnlab;
    1598              : 
    1599              : 
    1600              : /*-----------------------------------------------------------.
    1601              : | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
    1602              : `-----------------------------------------------------------*/
    1603            0 : yyexhaustedlab:
    1604            0 :   yyerror (result, parse_error_msg_p, yyscanner, YY_("memory exhausted"));
    1605            0 :   yyresult = 2;
    1606            0 :   goto yyreturnlab;
    1607              : 
    1608              : 
    1609              : /*----------------------------------------------------------.
    1610              : | yyreturnlab -- parsing is finished, clean up and return.  |
    1611              : `----------------------------------------------------------*/
    1612          243 : yyreturnlab:
    1613          243 :   if (yychar != YYEMPTY)
    1614              :     {
    1615              :       /* Make sure we have latest lookahead translation.  See comments at
    1616              :          user semantic actions for why this is necessary.  */
    1617           11 :       yytoken = YYTRANSLATE (yychar);
    1618           11 :       yydestruct ("Cleanup: discarding lookahead",
    1619              :                   yytoken, &yylval, result, parse_error_msg_p, yyscanner);
    1620              :     }
    1621              :   /* Do not reclaim the symbols of the rule whose action triggered
    1622              :      this YYABORT or YYACCEPT.  */
    1623          243 :   YYPOPSTACK (yylen);
    1624              :   YY_STACK_PRINT (yyss, yyssp);
    1625          707 :   while (yyssp != yyss)
    1626              :     {
    1627          464 :       yydestruct ("Cleanup: popping",
    1628          464 :                   YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, result, parse_error_msg_p, yyscanner);
    1629          464 :       YYPOPSTACK (1);
    1630              :     }
    1631              : #ifndef yyoverflow
    1632          243 :   if (yyss != yyssa)
    1633            0 :     YYSTACK_FREE (yyss);
    1634              : #endif
    1635              : 
    1636          243 :   return yyresult;
    1637              : }
    1638              : 
    1639              : #line 273 "pgpa_parser.y"
    1640              : 
    1641              : 
    1642              : /*
    1643              :  * Parse an advice_string and return the resulting list of pgpa_advice_item
    1644              :  * objects. If a parse error occurs, instead return NULL.
    1645              :  *
    1646              :  * If the return value is NULL, *error_p will be set to the error message;
    1647              :  * otherwise, *error_p will be set to NULL.
    1648              :  */
    1649              : List *
    1650              : pgpa_parse(const char *advice_string, char **error_p)
    1651              : {
    1652              :     yyscan_t    scanner;
    1653              :     List       *result;
    1654              :     char       *error = NULL;
    1655              : 
    1656              :     pgpa_scanner_init(advice_string, &scanner);
    1657              :     pgpa_yyparse(&result, &error, scanner);
    1658              :     pgpa_scanner_finish(scanner);
    1659              : 
    1660              :     if (error != NULL)
    1661              :     {
    1662              :         *error_p = error;
    1663              :         return NULL;
    1664              :     }
    1665              : 
    1666              :     *error_p = NULL;
    1667              :     return result;
    1668              : }
        

Generated by: LCOV version 2.0-1