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

Generated by: LCOV version 2.0-1