LCOV - code coverage report
Current view: top level - src/backend/utils/adt - jsonpath_gram.c (source / functions) Hit Total Coverage
Test: PostgreSQL 12beta2 Lines: 195 284 68.7 %
Date: 2019-06-18 07:06:57 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* A Bison parser, made by GNU Bison 3.0.4.  */
       2             : 
       3             : /* Bison implementation for Yacc-like parsers in C
       4             : 
       5             :    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
       6             : 
       7             :    This program is free software: you can redistribute it and/or modify
       8             :    it under the terms of the GNU General Public License as published by
       9             :    the Free Software Foundation, either version 3 of the License, or
      10             :    (at your option) any later version.
      11             : 
      12             :    This program is distributed in the hope that it will be useful,
      13             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :    GNU General Public License for more details.
      16             : 
      17             :    You should have received a copy of the GNU General Public License
      18             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
      19             : 
      20             : /* As a special exception, you may create a larger work that contains
      21             :    part or all of the Bison parser skeleton and distribute that work
      22             :    under terms of your choice, so long as that work isn't itself a
      23             :    parser generator using the skeleton or a modified version thereof
      24             :    as a parser skeleton.  Alternatively, if you modify or redistribute
      25             :    the parser skeleton itself, you may (at your option) remove this
      26             :    special exception, which will cause the skeleton and the resulting
      27             :    Bison output files to be licensed under the GNU General Public
      28             :    License without this special exception.
      29             : 
      30             :    This special exception was added by the Free Software Foundation in
      31             :    version 2.2 of Bison.  */
      32             : 
      33             : /* C LALR(1) parser skeleton written by Richard Stallman, by
      34             :    simplifying the original so-called "semantic" parser.  */
      35             : 
      36             : /* All symbols defined below should begin with yy or YY, to avoid
      37             :    infringing on user name space.  This should be done even for local
      38             :    variables, as they might otherwise be expanded by user macros.
      39             :    There are some unavoidable exceptions within include files to
      40             :    define necessary library symbols; they are noted "INFRINGES ON
      41             :    USER NAME SPACE" below.  */
      42             : 
      43             : /* Identify Bison output.  */
      44             : #define YYBISON 1
      45             : 
      46             : /* Bison version.  */
      47             : #define YYBISON_VERSION "3.0.4"
      48             : 
      49             : /* Skeleton name.  */
      50             : #define YYSKELETON_NAME "yacc.c"
      51             : 
      52             : /* Pure parsers.  */
      53             : #define YYPURE 1
      54             : 
      55             : /* Push parsers.  */
      56             : #define YYPUSH 0
      57             : 
      58             : /* Pull parsers.  */
      59             : #define YYPULL 1
      60             : 
      61             : 
      62             : /* Substitute the variable and function names.  */
      63             : #define yyparse         jsonpath_yyparse
      64             : #define yylex           jsonpath_yylex
      65             : #define yyerror         jsonpath_yyerror
      66             : #define yydebug         jsonpath_yydebug
      67             : #define yynerrs         jsonpath_yynerrs
      68             : 
      69             : 
      70             : /* Copy the first part of user declarations.  */
      71             : #line 1 "jsonpath_gram.y" /* yacc.c:339  */
      72             : 
      73             : /*-------------------------------------------------------------------------
      74             :  *
      75             :  * jsonpath_gram.y
      76             :  *   Grammar definitions for jsonpath datatype
      77             :  *
      78             :  * Transforms tokenized jsonpath into tree of JsonPathParseItem structs.
      79             :  *
      80             :  * Copyright (c) 2019, PostgreSQL Global Development Group
      81             :  *
      82             :  * IDENTIFICATION
      83             :  *  src/backend/utils/adt/jsonpath_gram.y
      84             :  *
      85             :  *-------------------------------------------------------------------------
      86             :  */
      87             : 
      88             : #include "postgres.h"
      89             : 
      90             : #include "catalog/pg_collation.h"
      91             : #include "fmgr.h"
      92             : #include "miscadmin.h"
      93             : #include "nodes/pg_list.h"
      94             : #include "regex/regex.h"
      95             : #include "utils/builtins.h"
      96             : #include "utils/jsonpath.h"
      97             : 
      98             : /* struct JsonPathString is shared between scan and gram */
      99             : typedef struct JsonPathString
     100             : {
     101             :     char       *val;
     102             :     int         len;
     103             :     int         total;
     104             : }           JsonPathString;
     105             : 
     106             : union YYSTYPE;
     107             : 
     108             : /* flex 2.5.4 doesn't bother with a decl for this */
     109             : int jsonpath_yylex(union YYSTYPE *yylval_param);
     110             : int jsonpath_yyparse(JsonPathParseResult **result);
     111             : void jsonpath_yyerror(JsonPathParseResult **result, const char *message);
     112             : 
     113             : static JsonPathParseItem *makeItemType(JsonPathItemType type);
     114             : static JsonPathParseItem *makeItemString(JsonPathString *s);
     115             : static JsonPathParseItem *makeItemVariable(JsonPathString *s);
     116             : static JsonPathParseItem *makeItemKey(JsonPathString *s);
     117             : static JsonPathParseItem *makeItemNumeric(JsonPathString *s);
     118             : static JsonPathParseItem *makeItemBool(bool val);
     119             : static JsonPathParseItem *makeItemBinary(JsonPathItemType type,
     120             :                                          JsonPathParseItem *la,
     121             :                                          JsonPathParseItem *ra);
     122             : static JsonPathParseItem *makeItemUnary(JsonPathItemType type,
     123             :                                         JsonPathParseItem *a);
     124             : static JsonPathParseItem *makeItemList(List *list);
     125             : static JsonPathParseItem *makeIndexArray(List *list);
     126             : static JsonPathParseItem *makeAny(int first, int last);
     127             : static JsonPathParseItem *makeItemLikeRegex(JsonPathParseItem *expr,
     128             :                                             JsonPathString *pattern,
     129             :                                             JsonPathString *flags);
     130             : 
     131             : /*
     132             :  * Bison doesn't allocate anything that needs to live across parser calls,
     133             :  * so we can easily have it use palloc instead of malloc.  This prevents
     134             :  * memory leaks if we error out during parsing.  Note this only works with
     135             :  * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
     136             :  * if possible, so there's not really much problem anyhow, at least if
     137             :  * you're building with gcc.
     138             :  */
     139             : #define YYMALLOC palloc
     140             : #define YYFREE   pfree
     141             : 
     142             : 
     143             : #line 144 "jsonpath_gram.c" /* yacc.c:339  */
     144             : 
     145             : # ifndef YY_NULLPTR
     146             : #  if defined __cplusplus && 201103L <= __cplusplus
     147             : #   define YY_NULLPTR nullptr
     148             : #  else
     149             : #   define YY_NULLPTR 0
     150             : #  endif
     151             : # endif
     152             : 
     153             : /* Enabling verbose error messages.  */
     154             : #ifdef YYERROR_VERBOSE
     155             : # undef YYERROR_VERBOSE
     156             : # define YYERROR_VERBOSE 1
     157             : #else
     158             : # define YYERROR_VERBOSE 1
     159             : #endif
     160             : 
     161             : 
     162             : /* Debug traces.  */
     163             : #ifndef YYDEBUG
     164             : # define YYDEBUG 0
     165             : #endif
     166             : #if YYDEBUG
     167             : extern int jsonpath_yydebug;
     168             : #endif
     169             : 
     170             : /* Token type.  */
     171             : #ifndef YYTOKENTYPE
     172             : # define YYTOKENTYPE
     173             :   enum yytokentype
     174             :   {
     175             :     TO_P = 258,
     176             :     NULL_P = 259,
     177             :     TRUE_P = 260,
     178             :     FALSE_P = 261,
     179             :     IS_P = 262,
     180             :     UNKNOWN_P = 263,
     181             :     EXISTS_P = 264,
     182             :     IDENT_P = 265,
     183             :     STRING_P = 266,
     184             :     NUMERIC_P = 267,
     185             :     INT_P = 268,
     186             :     VARIABLE_P = 269,
     187             :     OR_P = 270,
     188             :     AND_P = 271,
     189             :     NOT_P = 272,
     190             :     LESS_P = 273,
     191             :     LESSEQUAL_P = 274,
     192             :     EQUAL_P = 275,
     193             :     NOTEQUAL_P = 276,
     194             :     GREATEREQUAL_P = 277,
     195             :     GREATER_P = 278,
     196             :     ANY_P = 279,
     197             :     STRICT_P = 280,
     198             :     LAX_P = 281,
     199             :     LAST_P = 282,
     200             :     STARTS_P = 283,
     201             :     WITH_P = 284,
     202             :     LIKE_REGEX_P = 285,
     203             :     FLAG_P = 286,
     204             :     ABS_P = 287,
     205             :     SIZE_P = 288,
     206             :     TYPE_P = 289,
     207             :     FLOOR_P = 290,
     208             :     DOUBLE_P = 291,
     209             :     CEILING_P = 292,
     210             :     KEYVALUE_P = 293,
     211             :     UMINUS = 294
     212             :   };
     213             : #endif
     214             : 
     215             : /* Value type.  */
     216             : #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
     217             : 
     218             : union YYSTYPE
     219             : {
     220             : #line 80 "jsonpath_gram.y" /* yacc.c:355  */
     221             : 
     222             :     JsonPathString      str;
     223             :     List               *elems;  /* list of JsonPathParseItem */
     224             :     List               *indexs; /* list of integers */
     225             :     JsonPathParseItem  *value;
     226             :     JsonPathParseResult *result;
     227             :     JsonPathItemType    optype;
     228             :     bool                boolean;
     229             :     int                 integer;
     230             : 
     231             : #line 232 "jsonpath_gram.c" /* yacc.c:355  */
     232             : };
     233             : 
     234             : typedef union YYSTYPE YYSTYPE;
     235             : # define YYSTYPE_IS_TRIVIAL 1
     236             : # define YYSTYPE_IS_DECLARED 1
     237             : #endif
     238             : 
     239             : 
     240             : 
     241             : int jsonpath_yyparse (JsonPathParseResult **result);
     242             : 
     243             : 
     244             : 
     245             : /* Copy the second part of user declarations.  */
     246             : 
     247             : #line 248 "jsonpath_gram.c" /* yacc.c:358  */
     248             : 
     249             : #ifdef short
     250             : # undef short
     251             : #endif
     252             : 
     253             : #ifdef YYTYPE_UINT8
     254             : typedef YYTYPE_UINT8 yytype_uint8;
     255             : #else
     256             : typedef unsigned char yytype_uint8;
     257             : #endif
     258             : 
     259             : #ifdef YYTYPE_INT8
     260             : typedef YYTYPE_INT8 yytype_int8;
     261             : #else
     262             : typedef signed char yytype_int8;
     263             : #endif
     264             : 
     265             : #ifdef YYTYPE_UINT16
     266             : typedef YYTYPE_UINT16 yytype_uint16;
     267             : #else
     268             : typedef unsigned short int yytype_uint16;
     269             : #endif
     270             : 
     271             : #ifdef YYTYPE_INT16
     272             : typedef YYTYPE_INT16 yytype_int16;
     273             : #else
     274             : typedef short int yytype_int16;
     275             : #endif
     276             : 
     277             : #ifndef YYSIZE_T
     278             : # ifdef __SIZE_TYPE__
     279             : #  define YYSIZE_T __SIZE_TYPE__
     280             : # elif defined size_t
     281             : #  define YYSIZE_T size_t
     282             : # elif ! defined YYSIZE_T
     283             : #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
     284             : #  define YYSIZE_T size_t
     285             : # else
     286             : #  define YYSIZE_T unsigned int
     287             : # endif
     288             : #endif
     289             : 
     290             : #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
     291             : 
     292             : #ifndef YY_
     293             : # if defined YYENABLE_NLS && YYENABLE_NLS
     294             : #  if ENABLE_NLS
     295             : #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
     296             : #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
     297             : #  endif
     298             : # endif
     299             : # ifndef YY_
     300             : #  define YY_(Msgid) Msgid
     301             : # endif
     302             : #endif
     303             : 
     304             : #ifndef YY_ATTRIBUTE
     305             : # if (defined __GNUC__                                               \
     306             :       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
     307             :      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
     308             : #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
     309             : # else
     310             : #  define YY_ATTRIBUTE(Spec) /* empty */
     311             : # endif
     312             : #endif
     313             : 
     314             : #ifndef YY_ATTRIBUTE_PURE
     315             : # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
     316             : #endif
     317             : 
     318             : #ifndef YY_ATTRIBUTE_UNUSED
     319             : # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
     320             : #endif
     321             : 
     322             : #if !defined _Noreturn \
     323             :      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
     324             : # if defined _MSC_VER && 1200 <= _MSC_VER
     325             : #  define _Noreturn __declspec (noreturn)
     326             : # else
     327             : #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
     328             : # endif
     329             : #endif
     330             : 
     331             : /* Suppress unused-variable warnings by "using" E.  */
     332             : #if ! defined lint || defined __GNUC__
     333             : # define YYUSE(E) ((void) (E))
     334             : #else
     335             : # define YYUSE(E) /* empty */
     336             : #endif
     337             : 
     338             : #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
     339             : /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
     340             : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
     341             :     _Pragma ("GCC diagnostic push") \
     342             :     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
     343             :     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
     344             : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
     345             :     _Pragma ("GCC diagnostic pop")
     346             : #else
     347             : # define YY_INITIAL_VALUE(Value) Value
     348             : #endif
     349             : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     350             : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
     351             : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
     352             : #endif
     353             : #ifndef YY_INITIAL_VALUE
     354             : # define YY_INITIAL_VALUE(Value) /* Nothing. */
     355             : #endif
     356             : 
     357             : 
     358             : #if ! defined yyoverflow || YYERROR_VERBOSE
     359             : 
     360             : /* The parser invokes alloca or malloc; define the necessary symbols.  */
     361             : 
     362             : # ifdef YYSTACK_USE_ALLOCA
     363             : #  if YYSTACK_USE_ALLOCA
     364             : #   ifdef __GNUC__
     365             : #    define YYSTACK_ALLOC __builtin_alloca
     366             : #   elif defined __BUILTIN_VA_ARG_INCR
     367             : #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
     368             : #   elif defined _AIX
     369             : #    define YYSTACK_ALLOC __alloca
     370             : #   elif defined _MSC_VER
     371             : #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
     372             : #    define alloca _alloca
     373             : #   else
     374             : #    define YYSTACK_ALLOC alloca
     375             : #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
     376             : #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
     377             :       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
     378             : #     ifndef EXIT_SUCCESS
     379             : #      define EXIT_SUCCESS 0
     380             : #     endif
     381             : #    endif
     382             : #   endif
     383             : #  endif
     384             : # endif
     385             : 
     386             : # ifdef YYSTACK_ALLOC
     387             :    /* Pacify GCC's 'empty if-body' warning.  */
     388             : #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
     389             : #  ifndef YYSTACK_ALLOC_MAXIMUM
     390             :     /* The OS might guarantee only one guard page at the bottom of the stack,
     391             :        and a page size can be as small as 4096 bytes.  So we cannot safely
     392             :        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
     393             :        to allow for a few compiler-allocated temporary stack slots.  */
     394             : #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
     395             : #  endif
     396             : # else
     397             : #  define YYSTACK_ALLOC YYMALLOC
     398             : #  define YYSTACK_FREE YYFREE
     399             : #  ifndef YYSTACK_ALLOC_MAXIMUM
     400             : #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
     401             : #  endif
     402             : #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
     403             :        && ! ((defined YYMALLOC || defined malloc) \
     404             :              && (defined YYFREE || defined free)))
     405             : #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
     406             : #   ifndef EXIT_SUCCESS
     407             : #    define EXIT_SUCCESS 0
     408             : #   endif
     409             : #  endif
     410             : #  ifndef YYMALLOC
     411             : #   define YYMALLOC malloc
     412             : #   if ! defined malloc && ! defined EXIT_SUCCESS
     413             : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
     414             : #   endif
     415             : #  endif
     416             : #  ifndef YYFREE
     417             : #   define YYFREE free
     418             : #   if ! defined free && ! defined EXIT_SUCCESS
     419             : void free (void *); /* INFRINGES ON USER NAME SPACE */
     420             : #   endif
     421             : #  endif
     422             : # endif
     423             : #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
     424             : 
     425             : 
     426             : #if (! defined yyoverflow \
     427             :      && (! defined __cplusplus \
     428             :          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
     429             : 
     430             : /* A type that is properly aligned for any stack member.  */
     431             : union yyalloc
     432             : {
     433             :   yytype_int16 yyss_alloc;
     434             :   YYSTYPE yyvs_alloc;
     435             : };
     436             : 
     437             : /* The size of the maximum gap between one aligned stack and the next.  */
     438             : # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
     439             : 
     440             : /* The size of an array large to enough to hold all stacks, each with
     441             :    N elements.  */
     442             : # define YYSTACK_BYTES(N) \
     443             :      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
     444             :       + YYSTACK_GAP_MAXIMUM)
     445             : 
     446             : # define YYCOPY_NEEDED 1
     447             : 
     448             : /* Relocate STACK from its old location to the new one.  The
     449             :    local variables YYSIZE and YYSTACKSIZE give the old and new number of
     450             :    elements in the stack, and YYPTR gives the new location of the
     451             :    stack.  Advance YYPTR to a properly aligned location for the next
     452             :    stack.  */
     453             : # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
     454             :     do                                                                  \
     455             :       {                                                                 \
     456             :         YYSIZE_T yynewbytes;                                            \
     457             :         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
     458             :         Stack = &yyptr->Stack_alloc;                                    \
     459             :         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
     460             :         yyptr += yynewbytes / sizeof (*yyptr);                          \
     461             :       }                                                                 \
     462             :     while (0)
     463             : 
     464             : #endif
     465             : 
     466             : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
     467             : /* Copy COUNT objects from SRC to DST.  The source and destination do
     468             :    not overlap.  */
     469             : # ifndef YYCOPY
     470             : #  if defined __GNUC__ && 1 < __GNUC__
     471             : #   define YYCOPY(Dst, Src, Count) \
     472             :       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
     473             : #  else
     474             : #   define YYCOPY(Dst, Src, Count)              \
     475             :       do                                        \
     476             :         {                                       \
     477             :           YYSIZE_T yyi;                         \
     478             :           for (yyi = 0; yyi < (Count); yyi++)   \
     479             :             (Dst)[yyi] = (Src)[yyi];            \
     480             :         }                                       \
     481             :       while (0)
     482             : #  endif
     483             : # endif
     484             : #endif /* !YYCOPY_NEEDED */
     485             : 
     486             : /* YYFINAL -- State number of the termination state.  */
     487             : #define YYFINAL  5
     488             : /* YYLAST -- Last index in YYTABLE.  */
     489             : #define YYLAST   234
     490             : 
     491             : /* YYNTOKENS -- Number of terminals.  */
     492             : #define YYNTOKENS  56
     493             : /* YYNNTS -- Number of nonterminals.  */
     494             : #define YYNNTS  21
     495             : /* YYNRULES -- Number of rules.  */
     496             : #define YYNRULES  99
     497             : /* YYNSTATES -- Number of states.  */
     498             : #define YYNSTATES  137
     499             : 
     500             : /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
     501             :    by yylex, with out-of-bounds checking.  */
     502             : #define YYUNDEFTOK  2
     503             : #define YYMAXUTOK   294
     504             : 
     505             : #define YYTRANSLATE(YYX)                                                \
     506             :   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
     507             : 
     508             : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
     509             :    as returned by yylex, without out-of-bounds checking.  */
     510             : static const yytype_uint8 yytranslate[] =
     511             : {
     512             :        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     513             :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     514             :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     515             :        2,     2,     2,     2,     2,     2,    47,    43,     2,     2,
     516             :       45,    46,    41,    39,    49,    40,    54,    42,     2,     2,
     517             :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     518             :        2,     2,     2,    55,    48,     2,     2,     2,     2,     2,
     519             :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     520             :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     521             :        2,    50,     2,    51,     2,     2,     2,     2,     2,     2,
     522             :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     523             :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     524             :        2,     2,     2,    52,     2,    53,     2,     2,     2,     2,
     525             :        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     526             :        2,     2,     2,     2,     2,     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,     2,     2,     2,     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,     1,     2,     3,     4,
     538             :        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
     539             :       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
     540             :       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
     541             :       35,    36,    37,    38,    44
     542             : };
     543             : 
     544             : #if YYDEBUG
     545             :   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
     546             : static const yytype_uint16 yyrline[] =
     547             : {
     548             :        0,   128,   128,   133,   137,   138,   142,   143,   144,   148,
     549             :      149,   150,   151,   152,   153,   154,   158,   159,   160,   161,
     550             :      162,   163,   167,   168,   172,   173,   174,   175,   176,   177,
     551             :      179,   181,   182,   187,   188,   192,   193,   194,   195,   199,
     552             :      200,   201,   202,   206,   207,   208,   209,   210,   211,   212,
     553             :      213,   214,   218,   219,   223,   224,   228,   229,   233,   234,
     554             :      238,   239,   240,   245,   246,   247,   248,   249,   250,   254,
     555             :      258,   259,   260,   261,   262,   263,   264,   265,   266,   267,
     556             :      268,   269,   270,   271,   272,   273,   274,   275,   276,   277,
     557             :      278,   279,   280,   284,   285,   286,   287,   288,   289,   290
     558             : };
     559             : #endif
     560             : 
     561             : #if YYDEBUG || YYERROR_VERBOSE || 1
     562             : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
     563             :    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
     564             : static const char *const yytname[] =
     565             : {
     566             :   "$end", "error", "$undefined", "TO_P", "NULL_P", "TRUE_P", "FALSE_P",
     567             :   "IS_P", "UNKNOWN_P", "EXISTS_P", "IDENT_P", "STRING_P", "NUMERIC_P",
     568             :   "INT_P", "VARIABLE_P", "OR_P", "AND_P", "NOT_P", "LESS_P", "LESSEQUAL_P",
     569             :   "EQUAL_P", "NOTEQUAL_P", "GREATEREQUAL_P", "GREATER_P", "ANY_P",
     570             :   "STRICT_P", "LAX_P", "LAST_P", "STARTS_P", "WITH_P", "LIKE_REGEX_P",
     571             :   "FLAG_P", "ABS_P", "SIZE_P", "TYPE_P", "FLOOR_P", "DOUBLE_P",
     572             :   "CEILING_P", "KEYVALUE_P", "'+'", "'-'", "'*'", "'/'", "'%'", "UMINUS",
     573             :   "'('", "')'", "'$'", "'@'", "','", "'['", "']'", "'{'", "'}'", "'.'",
     574             :   "'?'", "$accept", "result", "expr_or_predicate", "mode", "scalar_value",
     575             :   "comp_op", "delimited_predicate", "predicate", "starts_with_initial",
     576             :   "path_primary", "accessor_expr", "expr", "index_elem", "index_list",
     577             :   "array_accessor", "any_level", "any_path", "accessor_op", "key",
     578             :   "key_name", "method", YY_NULLPTR
     579             : };
     580             : #endif
     581             : 
     582             : # ifdef YYPRINT
     583             : /* YYTOKNUM[NUM] -- (External) token number corresponding to the
     584             :    (internal) symbol number NUM (which must be that of a token).  */
     585             : static const yytype_uint16 yytoknum[] =
     586             : {
     587             :        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     588             :      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     589             :      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     590             :      285,   286,   287,   288,   289,   290,   291,   292,   293,    43,
     591             :       45,    42,    47,    37,   294,    40,    41,    36,    64,    44,
     592             :       91,    93,   123,   125,    46,    63
     593             : };
     594             : # endif
     595             : 
     596             : #define YYPACT_NINF -46
     597             : 
     598             : #define yypact_value_is_default(Yystate) \
     599             :   (!!((Yystate) == (-46)))
     600             : 
     601             : #define YYTABLE_NINF -100
     602             : 
     603             : #define yytable_value_is_error(Yytable_value) \
     604             :   0
     605             : 
     606             :   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     607             :      STATE-NUM.  */
     608             : static const yytype_int16 yypact[] =
     609             : {
     610             :       67,   -46,   -46,     8,    51,   -46,   -46,   -46,   -46,   -26,
     611             :      -46,   -46,   -46,   -46,    -3,   -46,   113,   113,    51,   -46,
     612             :      -46,   -46,   -46,   -46,    17,   -46,   -45,   191,   113,    51,
     613             :      -46,    51,   -46,   -46,    15,   162,    51,    51,    68,   138,
     614             :      -25,   -46,   -46,   -46,   -46,   -46,   -46,   -46,   -46,    42,
     615             :       14,   113,   113,   113,   113,   113,   113,    89,    20,   191,
     616             :       29,     4,   -45,    13,   -46,    -5,    -2,   -46,   -23,   -46,
     617             :      -46,   -46,   -46,   -46,   -46,   -46,   -46,   -46,    24,   -46,
     618             :      -46,   -46,   -46,   -46,   -46,   -46,    32,    38,    49,    52,
     619             :       59,    61,    69,   -46,   -46,   -46,   -46,    75,    51,     7,
     620             :       74,    60,    60,   -46,   -46,   -46,    46,   -46,   -46,   -45,
     621             :      104,   -46,   -46,   -46,   113,   113,   -46,   -11,    76,    54,
     622             :      -46,   -46,   -46,   110,   -46,    46,   -46,   -46,   -46,     0,
     623             :      -46,   -46,   -46,   -11,   -46,    70,   -46
     624             : };
     625             : 
     626             :   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
     627             :      Performed when YYTABLE does not specify something else to do.  Zero
     628             :      means the default is an error.  */
     629             : static const yytype_uint8 yydefact[] =
     630             : {
     631             :        8,     6,     7,     0,     0,     1,    10,    11,    12,     0,
     632             :        9,    13,    14,    15,     0,    38,     0,     0,     0,    36,
     633             :       37,     2,    35,    24,     5,    39,    43,     4,     0,     0,
     634             :       28,     0,    45,    46,     0,     0,     0,     0,     0,     0,
     635             :        0,    65,    42,    18,    20,    16,    17,    21,    19,     0,
     636             :        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     637             :        0,    22,    44,    27,    26,     0,    52,    54,     0,    72,
     638             :       73,    74,    75,    76,    77,    78,    70,    71,    60,    79,
     639             :       80,    88,    89,    90,    91,    92,    81,    82,    83,    84,
     640             :       85,    86,    87,    64,    66,    63,    69,     0,     0,     0,
     641             :       31,    47,    48,    49,    50,    51,    25,    23,    22,     0,
     642             :        0,    41,    40,    56,     0,     0,    57,     0,     0,     0,
     643             :       33,    34,    30,     0,    29,    53,    55,    58,    59,     0,
     644             :       67,    68,    32,     0,    61,     0,    62
     645             : };
     646             : 
     647             :   /* YYPGOTO[NTERM-NUM].  */
     648             : static const yytype_int8 yypgoto[] =
     649             : {
     650             :      -46,   -46,   -46,   -46,   -46,   -46,   119,   -14,   -46,   -46,
     651             :      -46,    -4,    19,   -46,   -46,     3,   -46,   -19,   -46,   -46,
     652             :      -46
     653             : };
     654             : 
     655             :   /* YYDEFGOTO[NTERM-NUM].  */
     656             : static const yytype_int16 yydefgoto[] =
     657             : {
     658             :       -1,     3,    21,     4,    22,    56,    23,    24,   122,    25,
     659             :       26,    59,    67,    68,    41,   129,    94,   111,    95,    96,
     660             :       97
     661             : };
     662             : 
     663             :   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
     664             :      positive, shift that token.  If negative, reduce the rule whose
     665             :      number is the opposite.  If YYTABLE_NINF, syntax error.  */
     666             : static const yytype_int16 yytable[] =
     667             : {
     668             :       27,   114,   127,   133,    34,    38,     9,    42,     5,    39,
     669             :       40,   110,    32,    33,    35,    58,   128,    60,   120,    28,
     670             :       98,   121,    63,    64,    57,   100,   115,    35,   116,    37,
     671             :       36,    37,    36,    37,    66,    36,    37,    51,    52,    53,
     672             :       54,    55,    29,   112,    36,    37,   113,   101,   102,   103,
     673             :      104,   105,   106,   134,    38,     6,     7,     8,    39,    40,
     674             :        9,    61,    10,    11,    12,    13,   108,    -3,    14,    36,
     675             :       37,    99,     6,     7,     8,   109,   117,   -93,    15,    10,
     676             :       11,    12,    13,   -94,   119,    51,    52,    53,    54,    55,
     677             :       16,    17,     1,     2,   -95,    15,    18,   -96,    19,    20,
     678             :      131,    53,    54,    55,   -97,   123,   -98,    16,    17,    65,
     679             :      125,    66,   124,    31,   -99,    19,    20,     6,     7,     8,
     680             :      118,   132,   130,   136,    10,    11,    12,    13,    51,    52,
     681             :       53,    54,    55,    30,   126,   107,   135,     0,     0,     0,
     682             :       15,    69,    70,    71,    72,    73,    74,    75,    76,    77,
     683             :        0,     0,    16,    17,     0,     0,     0,     0,    31,     0,
     684             :       19,    20,    78,    79,    80,    81,    82,    83,    84,    85,
     685             :       86,    87,    88,    89,    90,    91,    92,     0,     0,    93,
     686             :       43,    44,    45,    46,    47,    48,     0,     0,     0,     0,
     687             :       49,     0,    50,     0,     0,     0,     0,     0,     0,     0,
     688             :        0,    51,    52,    53,    54,    55,     0,     0,    62,    43,
     689             :       44,    45,    46,    47,    48,     0,     0,     0,     0,    49,
     690             :        0,    50,     0,     0,     0,     0,     0,     0,     0,     0,
     691             :       51,    52,    53,    54,    55
     692             : };
     693             : 
     694             : static const yytype_int16 yycheck[] =
     695             : {
     696             :        4,     3,    13,     3,    18,    50,     9,    26,     0,    54,
     697             :       55,     7,    16,    17,    18,    29,    27,    31,    11,    45,
     698             :       45,    14,    36,    37,    28,    11,    49,    31,    51,    16,
     699             :       15,    16,    15,    16,    38,    15,    16,    39,    40,    41,
     700             :       42,    43,    45,    62,    15,    16,    51,    51,    52,    53,
     701             :       54,    55,    56,    53,    50,     4,     5,     6,    54,    55,
     702             :        9,    46,    11,    12,    13,    14,    46,     0,    17,    15,
     703             :       16,    29,     4,     5,     6,    46,    52,    45,    27,    11,
     704             :       12,    13,    14,    45,    98,    39,    40,    41,    42,    43,
     705             :       39,    40,    25,    26,    45,    27,    45,    45,    47,    48,
     706             :       46,    41,    42,    43,    45,    31,    45,    39,    40,    41,
     707             :      114,   115,     8,    45,    45,    47,    48,     4,     5,     6,
     708             :       45,    11,    46,    53,    11,    12,    13,    14,    39,    40,
     709             :       41,    42,    43,    14,   115,    46,   133,    -1,    -1,    -1,
     710             :       27,     3,     4,     5,     6,     7,     8,     9,    10,    11,
     711             :       -1,    -1,    39,    40,    -1,    -1,    -1,    -1,    45,    -1,
     712             :       47,    48,    24,    25,    26,    27,    28,    29,    30,    31,
     713             :       32,    33,    34,    35,    36,    37,    38,    -1,    -1,    41,
     714             :       18,    19,    20,    21,    22,    23,    -1,    -1,    -1,    -1,
     715             :       28,    -1,    30,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     716             :       -1,    39,    40,    41,    42,    43,    -1,    -1,    46,    18,
     717             :       19,    20,    21,    22,    23,    -1,    -1,    -1,    -1,    28,
     718             :       -1,    30,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
     719             :       39,    40,    41,    42,    43
     720             : };
     721             : 
     722             :   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
     723             :      symbol of state STATE-NUM.  */
     724             : static const yytype_uint8 yystos[] =
     725             : {
     726             :        0,    25,    26,    57,    59,     0,     4,     5,     6,     9,
     727             :       11,    12,    13,    14,    17,    27,    39,    40,    45,    47,
     728             :       48,    58,    60,    62,    63,    65,    66,    67,    45,    45,
     729             :       62,    45,    67,    67,    63,    67,    15,    16,    50,    54,
     730             :       55,    70,    73,    18,    19,    20,    21,    22,    23,    28,
     731             :       30,    39,    40,    41,    42,    43,    61,    67,    63,    67,
     732             :       63,    46,    46,    63,    63,    41,    67,    68,    69,     3,
     733             :        4,     5,     6,     7,     8,     9,    10,    11,    24,    25,
     734             :       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
     735             :       36,    37,    38,    41,    72,    74,    75,    76,    45,    29,
     736             :       11,    67,    67,    67,    67,    67,    67,    46,    46,    46,
     737             :        7,    73,    73,    51,     3,    49,    51,    52,    45,    63,
     738             :       11,    14,    64,    31,     8,    67,    68,    13,    27,    71,
     739             :       46,    46,    11,     3,    53,    71,    53
     740             : };
     741             : 
     742             :   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
     743             : static const yytype_uint8 yyr1[] =
     744             : {
     745             :        0,    56,    57,    57,    58,    58,    59,    59,    59,    60,
     746             :       60,    60,    60,    60,    60,    60,    61,    61,    61,    61,
     747             :       61,    61,    62,    62,    63,    63,    63,    63,    63,    63,
     748             :       63,    63,    63,    64,    64,    65,    65,    65,    65,    66,
     749             :       66,    66,    66,    67,    67,    67,    67,    67,    67,    67,
     750             :       67,    67,    68,    68,    69,    69,    70,    70,    71,    71,
     751             :       72,    72,    72,    73,    73,    73,    73,    73,    73,    74,
     752             :       75,    75,    75,    75,    75,    75,    75,    75,    75,    75,
     753             :       75,    75,    75,    75,    75,    75,    75,    75,    75,    75,
     754             :       75,    75,    75,    76,    76,    76,    76,    76,    76,    76
     755             : };
     756             : 
     757             :   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
     758             : static const yytype_uint8 yyr2[] =
     759             : {
     760             :        0,     2,     2,     0,     1,     1,     1,     1,     0,     1,
     761             :        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     762             :        1,     1,     3,     4,     1,     3,     3,     3,     2,     5,
     763             :        4,     3,     5,     1,     1,     1,     1,     1,     1,     1,
     764             :        4,     4,     2,     1,     3,     2,     2,     3,     3,     3,
     765             :        3,     3,     1,     3,     1,     3,     3,     3,     1,     1,
     766             :        1,     4,     6,     2,     2,     1,     2,     4,     4,     1,
     767             :        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     768             :        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     769             :        1,     1,     1,     1,     1,     1,     1,     1,     1,     1
     770             : };
     771             : 
     772             : 
     773             : #define yyerrok         (yyerrstatus = 0)
     774             : #define yyclearin       (yychar = YYEMPTY)
     775             : #define YYEMPTY         (-2)
     776             : #define YYEOF           0
     777             : 
     778             : #define YYACCEPT        goto yyacceptlab
     779             : #define YYABORT         goto yyabortlab
     780             : #define YYERROR         goto yyerrorlab
     781             : 
     782             : 
     783             : #define YYRECOVERING()  (!!yyerrstatus)
     784             : 
     785             : #define YYBACKUP(Token, Value)                                  \
     786             : do                                                              \
     787             :   if (yychar == YYEMPTY)                                        \
     788             :     {                                                           \
     789             :       yychar = (Token);                                         \
     790             :       yylval = (Value);                                         \
     791             :       YYPOPSTACK (yylen);                                       \
     792             :       yystate = *yyssp;                                         \
     793             :       goto yybackup;                                            \
     794             :     }                                                           \
     795             :   else                                                          \
     796             :     {                                                           \
     797             :       yyerror (result, YY_("syntax error: cannot back up")); \
     798             :       YYERROR;                                                  \
     799             :     }                                                           \
     800             : while (0)
     801             : 
     802             : /* Error token number */
     803             : #define YYTERROR        1
     804             : #define YYERRCODE       256
     805             : 
     806             : 
     807             : 
     808             : /* Enable debugging if requested.  */
     809             : #if YYDEBUG
     810             : 
     811             : # ifndef YYFPRINTF
     812             : #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
     813             : #  define YYFPRINTF fprintf
     814             : # endif
     815             : 
     816             : # define YYDPRINTF(Args)                        \
     817             : do {                                            \
     818             :   if (yydebug)                                  \
     819             :     YYFPRINTF Args;                             \
     820             : } while (0)
     821             : 
     822             : /* This macro is provided for backward compatibility. */
     823             : #ifndef YY_LOCATION_PRINT
     824             : # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
     825             : #endif
     826             : 
     827             : 
     828             : # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
     829             : do {                                                                      \
     830             :   if (yydebug)                                                            \
     831             :     {                                                                     \
     832             :       YYFPRINTF (stderr, "%s ", Title);                                   \
     833             :       yy_symbol_print (stderr,                                            \
     834             :                   Type, Value, result); \
     835             :       YYFPRINTF (stderr, "\n");                                           \
     836             :     }                                                                     \
     837             : } while (0)
     838             : 
     839             : 
     840             : /*----------------------------------------.
     841             : | Print this symbol's value on YYOUTPUT.  |
     842             : `----------------------------------------*/
     843             : 
     844             : static void
     845             : yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, JsonPathParseResult **result)
     846             : {
     847             :   FILE *yyo = yyoutput;
     848             :   YYUSE (yyo);
     849             :   YYUSE (result);
     850             :   if (!yyvaluep)
     851             :     return;
     852             : # ifdef YYPRINT
     853             :   if (yytype < YYNTOKENS)
     854             :     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
     855             : # endif
     856             :   YYUSE (yytype);
     857             : }
     858             : 
     859             : 
     860             : /*--------------------------------.
     861             : | Print this symbol on YYOUTPUT.  |
     862             : `--------------------------------*/
     863             : 
     864             : static void
     865             : yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, JsonPathParseResult **result)
     866             : {
     867             :   YYFPRINTF (yyoutput, "%s %s (",
     868             :              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
     869             : 
     870             :   yy_symbol_value_print (yyoutput, yytype, yyvaluep, result);
     871             :   YYFPRINTF (yyoutput, ")");
     872             : }
     873             : 
     874             : /*------------------------------------------------------------------.
     875             : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
     876             : | TOP (included).                                                   |
     877             : `------------------------------------------------------------------*/
     878             : 
     879             : static void
     880             : yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
     881             : {
     882             :   YYFPRINTF (stderr, "Stack now");
     883             :   for (; yybottom <= yytop; yybottom++)
     884             :     {
     885             :       int yybot = *yybottom;
     886             :       YYFPRINTF (stderr, " %d", yybot);
     887             :     }
     888             :   YYFPRINTF (stderr, "\n");
     889             : }
     890             : 
     891             : # define YY_STACK_PRINT(Bottom, Top)                            \
     892             : do {                                                            \
     893             :   if (yydebug)                                                  \
     894             :     yy_stack_print ((Bottom), (Top));                           \
     895             : } while (0)
     896             : 
     897             : 
     898             : /*------------------------------------------------.
     899             : | Report that the YYRULE is going to be reduced.  |
     900             : `------------------------------------------------*/
     901             : 
     902             : static void
     903             : yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, JsonPathParseResult **result)
     904             : {
     905             :   unsigned long int yylno = yyrline[yyrule];
     906             :   int yynrhs = yyr2[yyrule];
     907             :   int yyi;
     908             :   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
     909             :              yyrule - 1, yylno);
     910             :   /* The symbols being reduced.  */
     911             :   for (yyi = 0; yyi < yynrhs; yyi++)
     912             :     {
     913             :       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
     914             :       yy_symbol_print (stderr,
     915             :                        yystos[yyssp[yyi + 1 - yynrhs]],
     916             :                        &(yyvsp[(yyi + 1) - (yynrhs)])
     917             :                                               , result);
     918             :       YYFPRINTF (stderr, "\n");
     919             :     }
     920             : }
     921             : 
     922             : # define YY_REDUCE_PRINT(Rule)          \
     923             : do {                                    \
     924             :   if (yydebug)                          \
     925             :     yy_reduce_print (yyssp, yyvsp, Rule, result); \
     926             : } while (0)
     927             : 
     928             : /* Nonzero means print parse trace.  It is left uninitialized so that
     929             :    multiple parsers can coexist.  */
     930             : int yydebug;
     931             : #else /* !YYDEBUG */
     932             : # define YYDPRINTF(Args)
     933             : # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
     934             : # define YY_STACK_PRINT(Bottom, Top)
     935             : # define YY_REDUCE_PRINT(Rule)
     936             : #endif /* !YYDEBUG */
     937             : 
     938             : 
     939             : /* YYINITDEPTH -- initial size of the parser's stacks.  */
     940             : #ifndef YYINITDEPTH
     941             : # define YYINITDEPTH 200
     942             : #endif
     943             : 
     944             : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
     945             :    if the built-in stack extension method is used).
     946             : 
     947             :    Do not make this value too large; the results are undefined if
     948             :    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
     949             :    evaluated with infinite-precision integer arithmetic.  */
     950             : 
     951             : #ifndef YYMAXDEPTH
     952             : # define YYMAXDEPTH 10000
     953             : #endif
     954             : 
     955             : 
     956             : #if YYERROR_VERBOSE
     957             : 
     958             : # ifndef yystrlen
     959             : #  if defined __GLIBC__ && defined _STRING_H
     960             : #   define yystrlen strlen
     961             : #  else
     962             : /* Return the length of YYSTR.  */
     963             : static YYSIZE_T
     964             : yystrlen (const char *yystr)
     965             : {
     966             :   YYSIZE_T yylen;
     967             :   for (yylen = 0; yystr[yylen]; yylen++)
     968             :     continue;
     969             :   return yylen;
     970             : }
     971             : #  endif
     972             : # endif
     973             : 
     974             : # ifndef yystpcpy
     975             : #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
     976             : #   define yystpcpy stpcpy
     977             : #  else
     978             : /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
     979             :    YYDEST.  */
     980             : static char *
     981             : yystpcpy (char *yydest, const char *yysrc)
     982             : {
     983             :   char *yyd = yydest;
     984             :   const char *yys = yysrc;
     985             : 
     986             :   while ((*yyd++ = *yys++) != '\0')
     987             :     continue;
     988             : 
     989             :   return yyd - 1;
     990             : }
     991             : #  endif
     992             : # endif
     993             : 
     994             : # ifndef yytnamerr
     995             : /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
     996             :    quotes and backslashes, so that it's suitable for yyerror.  The
     997             :    heuristic is that double-quoting is unnecessary unless the string
     998             :    contains an apostrophe, a comma, or backslash (other than
     999             :    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
    1000             :    null, do not copy; instead, return the length of what the result
    1001             :    would have been.  */
    1002             : static YYSIZE_T
    1003         408 : yytnamerr (char *yyres, const char *yystr)
    1004             : {
    1005         408 :   if (*yystr == '"')
    1006             :     {
    1007           0 :       YYSIZE_T yyn = 0;
    1008           0 :       char const *yyp = yystr;
    1009             : 
    1010             :       for (;;)
    1011           0 :         switch (*++yyp)
    1012             :           {
    1013             :           case '\'':
    1014             :           case ',':
    1015           0 :             goto do_not_strip_quotes;
    1016             : 
    1017             :           case '\\':
    1018           0 :             if (*++yyp != '\\')
    1019           0 :               goto do_not_strip_quotes;
    1020             :             /* Fall through.  */
    1021             :           default:
    1022           0 :             if (yyres)
    1023           0 :               yyres[yyn] = *yyp;
    1024           0 :             yyn++;
    1025           0 :             break;
    1026             : 
    1027             :           case '"':
    1028           0 :             if (yyres)
    1029           0 :               yyres[yyn] = '\0';
    1030           0 :             return yyn;
    1031             :           }
    1032             :     do_not_strip_quotes: ;
    1033             :     }
    1034             : 
    1035         408 :   if (! yyres)
    1036         340 :     return yystrlen (yystr);
    1037             : 
    1038          68 :   return yystpcpy (yyres, yystr) - yyres;
    1039             : }
    1040             : # endif
    1041             : 
    1042             : /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
    1043             :    about the unexpected token YYTOKEN for the state stack whose top is
    1044             :    YYSSP.
    1045             : 
    1046             :    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
    1047             :    not large enough to hold the message.  In that case, also set
    1048             :    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
    1049             :    required number of bytes is too large to store.  */
    1050             : static int
    1051          68 : yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
    1052             :                 yytype_int16 *yyssp, int yytoken)
    1053             : {
    1054          68 :   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
    1055          68 :   YYSIZE_T yysize = yysize0;
    1056             :   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
    1057             :   /* Internationalized format string. */
    1058          68 :   const char *yyformat = YY_NULLPTR;
    1059             :   /* Arguments of yyformat. */
    1060             :   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
    1061             :   /* Number of reported tokens (one for the "unexpected", one per
    1062             :      "expected"). */
    1063          68 :   int yycount = 0;
    1064             : 
    1065             :   /* There are many possibilities here to consider:
    1066             :      - If this state is a consistent state with a default action, then
    1067             :        the only way this function was invoked is if the default action
    1068             :        is an error action.  In that case, don't check for expected
    1069             :        tokens because there are none.
    1070             :      - The only way there can be no lookahead present (in yychar) is if
    1071             :        this state is a consistent state with a default action.  Thus,
    1072             :        detecting the absence of a lookahead is sufficient to determine
    1073             :        that there is no unexpected or expected token to report.  In that
    1074             :        case, just report a simple "syntax error".
    1075             :      - Don't assume there isn't a lookahead just because this state is a
    1076             :        consistent state with a default action.  There might have been a
    1077             :        previous inconsistent state, consistent state with a non-default
    1078             :        action, or user semantic action that manipulated yychar.
    1079             :      - Of course, the expected token list depends on states to have
    1080             :        correct lookahead information, and it depends on the parser not
    1081             :        to perform extra reductions after fetching a lookahead from the
    1082             :        scanner and before detecting a syntax error.  Thus, state merging
    1083             :        (from LALR or IELR) and default reductions corrupt the expected
    1084             :        token list.  However, the list is correct for canonical LR with
    1085             :        one exception: it will still contain any token that will not be
    1086             :        accepted due to an error action in a later state.
    1087             :   */
    1088          68 :   if (yytoken != YYEMPTY)
    1089             :     {
    1090          68 :       int yyn = yypact[*yyssp];
    1091          68 :       yyarg[yycount++] = yytname[yytoken];
    1092          68 :       if (!yypact_value_is_default (yyn))
    1093             :         {
    1094             :           /* Start YYX at -YYN if negative to avoid negative indexes in
    1095             :              YYCHECK.  In other words, skip the first -YYN actions for
    1096             :              this state because they are default actions.  */
    1097          68 :           int yyxbegin = yyn < 0 ? -yyn : 0;
    1098             :           /* Stay within bounds of both yycheck and yytname.  */
    1099          68 :           int yychecklim = YYLAST - yyn + 1;
    1100          68 :           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
    1101             :           int yyx;
    1102             : 
    1103         800 :           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
    1104         800 :             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
    1105         340 :                 && !yytable_value_is_error (yytable[yyx + yyn]))
    1106             :               {
    1107         340 :                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
    1108             :                   {
    1109          68 :                     yycount = 1;
    1110          68 :                     yysize = yysize0;
    1111          68 :                     break;
    1112             :                   }
    1113         272 :                 yyarg[yycount++] = yytname[yyx];
    1114             :                 {
    1115         272 :                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
    1116         272 :                   if (! (yysize <= yysize1
    1117             :                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
    1118           0 :                     return 2;
    1119         272 :                   yysize = yysize1;
    1120             :                 }
    1121             :               }
    1122             :         }
    1123             :     }
    1124             : 
    1125          68 :   switch (yycount)
    1126             :     {
    1127             : # define YYCASE_(N, S)                      \
    1128             :       case N:                               \
    1129             :         yyformat = S;                       \
    1130             :       break
    1131           0 :       YYCASE_(0, YY_("syntax error"));
    1132          68 :       YYCASE_(1, YY_("syntax error, unexpected %s"));
    1133           0 :       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
    1134           0 :       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
    1135           0 :       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
    1136           0 :       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
    1137             : # undef YYCASE_
    1138             :     }
    1139             : 
    1140             :   {
    1141          68 :     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
    1142          68 :     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
    1143           0 :       return 2;
    1144          68 :     yysize = yysize1;
    1145             :   }
    1146             : 
    1147          68 :   if (*yymsg_alloc < yysize)
    1148             :     {
    1149           0 :       *yymsg_alloc = 2 * yysize;
    1150           0 :       if (! (yysize <= *yymsg_alloc
    1151             :              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
    1152           0 :         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
    1153           0 :       return 1;
    1154             :     }
    1155             : 
    1156             :   /* Avoid sprintf, as that infringes on the user's name space.
    1157             :      Don't have undefined behavior even if the translation
    1158             :      produced a string with the wrong number of "%s"s.  */
    1159             :   {
    1160          68 :     char *yyp = *yymsg;
    1161          68 :     int yyi = 0;
    1162        1904 :     while ((*yyp = *yyformat) != '\0')
    1163        1768 :       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
    1164             :         {
    1165          68 :           yyp += yytnamerr (yyp, yyarg[yyi++]);
    1166          68 :           yyformat += 2;
    1167             :         }
    1168             :       else
    1169             :         {
    1170        1700 :           yyp++;
    1171        1700 :           yyformat++;
    1172             :         }
    1173             :   }
    1174          68 :   return 0;
    1175             : }
    1176             : #endif /* YYERROR_VERBOSE */
    1177             : 
    1178             : /*-----------------------------------------------.
    1179             : | Release the memory associated to this symbol.  |
    1180             : `-----------------------------------------------*/
    1181             : 
    1182             : static void
    1183        4448 : yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, JsonPathParseResult **result)
    1184             : {
    1185             :   YYUSE (yyvaluep);
    1186             :   YYUSE (result);
    1187        4448 :   if (!yymsg)
    1188           0 :     yymsg = "Deleting";
    1189             :   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
    1190             : 
    1191             :   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
    1192             :   YYUSE (yytype);
    1193             :   YY_IGNORE_MAYBE_UNINITIALIZED_END
    1194        4448 : }
    1195             : 
    1196             : 
    1197             : 
    1198             : 
    1199             : /*----------.
    1200             : | yyparse.  |
    1201             : `----------*/
    1202             : 
    1203             : int
    1204        2384 : yyparse (JsonPathParseResult **result)
    1205             : {
    1206             : /* The lookahead symbol.  */
    1207             : int yychar;
    1208             : 
    1209             : 
    1210             : /* The semantic value of the lookahead symbol.  */
    1211             : /* Default value used for initialization, for pacifying older GCCs
    1212             :    or non-GCC compilers.  */
    1213             : YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
    1214             : YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
    1215             : 
    1216             :     /* Number of syntax errors so far.  */
    1217             :     int yynerrs;
    1218             : 
    1219             :     int yystate;
    1220             :     /* Number of tokens to shift before error messages enabled.  */
    1221             :     int yyerrstatus;
    1222             : 
    1223             :     /* The stacks and their tools:
    1224             :        'yyss': related to states.
    1225             :        'yyvs': related to semantic values.
    1226             : 
    1227             :        Refer to the stacks through separate pointers, to allow yyoverflow
    1228             :        to reallocate them elsewhere.  */
    1229             : 
    1230             :     /* The state stack.  */
    1231             :     yytype_int16 yyssa[YYINITDEPTH];
    1232             :     yytype_int16 *yyss;
    1233             :     yytype_int16 *yyssp;
    1234             : 
    1235             :     /* The semantic value stack.  */
    1236             :     YYSTYPE yyvsa[YYINITDEPTH];
    1237             :     YYSTYPE *yyvs;
    1238             :     YYSTYPE *yyvsp;
    1239             : 
    1240             :     YYSIZE_T yystacksize;
    1241             : 
    1242             :   int yyn;
    1243             :   int yyresult;
    1244             :   /* Lookahead token as an internal (translated) token number.  */
    1245        2384 :   int yytoken = 0;
    1246             :   /* The variables used to return semantic value and location from the
    1247             :      action routines.  */
    1248             :   YYSTYPE yyval;
    1249             : 
    1250             : #if YYERROR_VERBOSE
    1251             :   /* Buffer for error messages, and its allocated size.  */
    1252             :   char yymsgbuf[128];
    1253        2384 :   char *yymsg = yymsgbuf;
    1254        2384 :   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
    1255             : #endif
    1256             : 
    1257             : #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
    1258             : 
    1259             :   /* The number of symbols on the RHS of the reduced rule.
    1260             :      Keep to zero when no symbol should be popped.  */
    1261        2384 :   int yylen = 0;
    1262             : 
    1263        2384 :   yyssp = yyss = yyssa;
    1264        2384 :   yyvsp = yyvs = yyvsa;
    1265        2384 :   yystacksize = YYINITDEPTH;
    1266             : 
    1267             :   YYDPRINTF ((stderr, "Starting parse\n"));
    1268             : 
    1269        2384 :   yystate = 0;
    1270        2384 :   yyerrstatus = 0;
    1271        2384 :   yynerrs = 0;
    1272        2384 :   yychar = YYEMPTY; /* Cause a token to be read.  */
    1273        2384 :   goto yysetstate;
    1274             : 
    1275             : /*------------------------------------------------------------.
    1276             : | yynewstate -- Push a new state, which is found in yystate.  |
    1277             : `------------------------------------------------------------*/
    1278             :  yynewstate:
    1279             :   /* In all cases, when you get here, the value and location stacks
    1280             :      have just been pushed.  So pushing a state here evens the stacks.  */
    1281       61632 :   yyssp++;
    1282             : 
    1283             :  yysetstate:
    1284       64016 :   *yyssp = yystate;
    1285             : 
    1286       64016 :   if (yyss + yystacksize - 1 <= yyssp)
    1287             :     {
    1288             :       /* Get the current used size of the three stacks, in elements.  */
    1289           0 :       YYSIZE_T yysize = yyssp - yyss + 1;
    1290             : 
    1291             : #ifdef yyoverflow
    1292             :       {
    1293             :         /* Give user a chance to reallocate the stack.  Use copies of
    1294             :            these so that the &'s don't force the real ones into
    1295             :            memory.  */
    1296             :         YYSTYPE *yyvs1 = yyvs;
    1297             :         yytype_int16 *yyss1 = yyss;
    1298             : 
    1299             :         /* Each stack pointer address is followed by the size of the
    1300             :            data in use in that stack, in bytes.  This used to be a
    1301             :            conditional around just the two extra args, but that might
    1302             :            be undefined if yyoverflow is a macro.  */
    1303             :         yyoverflow (YY_("memory exhausted"),
    1304             :                     &yyss1, yysize * sizeof (*yyssp),
    1305             :                     &yyvs1, yysize * sizeof (*yyvsp),
    1306             :                     &yystacksize);
    1307             : 
    1308             :         yyss = yyss1;
    1309             :         yyvs = yyvs1;
    1310             :       }
    1311             : #else /* no yyoverflow */
    1312             : # ifndef YYSTACK_RELOCATE
    1313             :       goto yyexhaustedlab;
    1314             : # else
    1315             :       /* Extend the stack our own way.  */
    1316           0 :       if (YYMAXDEPTH <= yystacksize)
    1317           0 :         goto yyexhaustedlab;
    1318           0 :       yystacksize *= 2;
    1319           0 :       if (YYMAXDEPTH < yystacksize)
    1320           0 :         yystacksize = YYMAXDEPTH;
    1321             : 
    1322             :       {
    1323           0 :         yytype_int16 *yyss1 = yyss;
    1324           0 :         union yyalloc *yyptr =
    1325           0 :           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
    1326           0 :         if (! yyptr)
    1327           0 :           goto yyexhaustedlab;
    1328           0 :         YYSTACK_RELOCATE (yyss_alloc, yyss);
    1329           0 :         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
    1330             : #  undef YYSTACK_RELOCATE
    1331           0 :         if (yyss1 != yyssa)
    1332           0 :           YYSTACK_FREE (yyss1);
    1333             :       }
    1334             : # endif
    1335             : #endif /* no yyoverflow */
    1336             : 
    1337           0 :       yyssp = yyss + yysize - 1;
    1338           0 :       yyvsp = yyvs + yysize - 1;
    1339             : 
    1340             :       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
    1341             :                   (unsigned long int) yystacksize));
    1342             : 
    1343           0 :       if (yyss + yystacksize - 1 <= yyssp)
    1344           0 :         YYABORT;
    1345             :     }
    1346             : 
    1347             :   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
    1348             : 
    1349       64016 :   if (yystate == YYFINAL)
    1350        2224 :     YYACCEPT;
    1351             : 
    1352       61792 :   goto yybackup;
    1353             : 
    1354             : /*-----------.
    1355             : | yybackup.  |
    1356             : `-----------*/
    1357             : yybackup:
    1358             : 
    1359             :   /* Do appropriate processing given the current state.  Read a
    1360             :      lookahead token if we need one and don't already have one.  */
    1361             : 
    1362             :   /* First try to decide what to do without reference to lookahead token.  */
    1363       61792 :   yyn = yypact[yystate];
    1364       61792 :   if (yypact_value_is_default (yyn))
    1365       29108 :     goto yydefault;
    1366             : 
    1367             :   /* Not known => get a lookahead token if don't already have one.  */
    1368             : 
    1369             :   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
    1370       32684 :   if (yychar == YYEMPTY)
    1371             :     {
    1372             :       YYDPRINTF ((stderr, "Reading a token: "));
    1373       21728 :       yychar = yylex (&yylval);
    1374             :     }
    1375             : 
    1376       32600 :   if (yychar <= YYEOF)
    1377             :     {
    1378        6768 :       yychar = yytoken = YYEOF;
    1379             :       YYDPRINTF ((stderr, "Now at end of input.\n"));
    1380             :     }
    1381             :   else
    1382             :     {
    1383       25832 :       yytoken = YYTRANSLATE (yychar);
    1384             :       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    1385             :     }
    1386             : 
    1387             :   /* If the proper action on seeing token YYTOKEN is to reduce or to
    1388             :      detect an error, take that action.  */
    1389       32600 :   yyn += yytoken;
    1390       32600 :   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    1391             :     goto yydefault;
    1392       21868 :   yyn = yytable[yyn];
    1393       21868 :   if (yyn <= 0)
    1394             :     {
    1395             :       if (yytable_value_is_error (yyn))
    1396             :         goto yyerrlab;
    1397         296 :       yyn = -yyn;
    1398         296 :       goto yyreduce;
    1399             :     }
    1400             : 
    1401             :   /* Count tokens shifted since error; after three, turn off error
    1402             :      status.  */
    1403       21572 :   if (yyerrstatus)
    1404           0 :     yyerrstatus--;
    1405             : 
    1406             :   /* Shift the lookahead token.  */
    1407             :   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
    1408             : 
    1409             :   /* Discard the shifted token.  */
    1410       21572 :   yychar = YYEMPTY;
    1411             : 
    1412       21572 :   yystate = yyn;
    1413             :   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
    1414       21572 :   *++yyvsp = yylval;
    1415             :   YY_IGNORE_MAYBE_UNINITIALIZED_END
    1416             : 
    1417       21572 :   goto yynewstate;
    1418             : 
    1419             : 
    1420             : /*-----------------------------------------------------------.
    1421             : | yydefault -- do the default action for the current state.  |
    1422             : `-----------------------------------------------------------*/
    1423             : yydefault:
    1424       39840 :   yyn = yydefact[yystate];
    1425       39840 :   if (yyn == 0)
    1426          68 :     goto yyerrlab;
    1427       39772 :   goto yyreduce;
    1428             : 
    1429             : 
    1430             : /*-----------------------------.
    1431             : | yyreduce -- Do a reduction.  |
    1432             : `-----------------------------*/
    1433             : yyreduce:
    1434             :   /* yyn is the number of a rule to reduce with.  */
    1435       40068 :   yylen = yyr2[yyn];
    1436             : 
    1437             :   /* If YYLEN is nonzero, implement the default value of the action:
    1438             :      '$$ = $1'.
    1439             : 
    1440             :      Otherwise, the following line sets YYVAL to garbage.
    1441             :      This behavior is undocumented and Bison
    1442             :      users should not rely upon it.  Assigning to YYVAL
    1443             :      unconditionally makes the parser a bit smaller, and it avoids a
    1444             :      GCC warning that YYVAL may be used uninitialized.  */
    1445       40068 :   yyval = yyvsp[1-yylen];
    1446             : 
    1447             : 
    1448             :   YY_REDUCE_PRINT (yyn);
    1449       40068 :   switch (yyn)
    1450             :     {
    1451             :         case 2:
    1452             : #line 128 "jsonpath_gram.y" /* yacc.c:1646  */
    1453             :     {
    1454             :                                         *result = palloc(sizeof(JsonPathParseResult));
    1455             :                                         (*result)->expr = (yyvsp[0].value);
    1456             :                                         (*result)->lax = (yyvsp[-1].boolean);
    1457             :                                     }
    1458             : #line 1459 "jsonpath_gram.c" /* yacc.c:1646  */
    1459        2220 :     break;
    1460             : 
    1461             :   case 3:
    1462             : #line 133 "jsonpath_gram.y" /* yacc.c:1646  */
    1463             :     { *result = NULL; }
    1464             : #line 1465 "jsonpath_gram.c" /* yacc.c:1646  */
    1465           4 :     break;
    1466             : 
    1467             :   case 4:
    1468             : #line 137 "jsonpath_gram.y" /* yacc.c:1646  */
    1469             :     { (yyval.value) = (yyvsp[0].value); }
    1470             : #line 1471 "jsonpath_gram.c" /* yacc.c:1646  */
    1471        1988 :     break;
    1472             : 
    1473             :   case 5:
    1474             : #line 138 "jsonpath_gram.y" /* yacc.c:1646  */
    1475             :     { (yyval.value) = (yyvsp[0].value); }
    1476             : #line 1477 "jsonpath_gram.c" /* yacc.c:1646  */
    1477         232 :     break;
    1478             : 
    1479             :   case 6:
    1480             : #line 142 "jsonpath_gram.y" /* yacc.c:1646  */
    1481             :     { (yyval.boolean) = false; }
    1482             : #line 1483 "jsonpath_gram.c" /* yacc.c:1646  */
    1483         232 :     break;
    1484             : 
    1485             :   case 7:
    1486             : #line 143 "jsonpath_gram.y" /* yacc.c:1646  */
    1487             :     { (yyval.boolean) = true; }
    1488             : #line 1489 "jsonpath_gram.c" /* yacc.c:1646  */
    1489         280 :     break;
    1490             : 
    1491             :   case 8:
    1492             : #line 144 "jsonpath_gram.y" /* yacc.c:1646  */
    1493             :     { (yyval.boolean) = true; }
    1494             : #line 1495 "jsonpath_gram.c" /* yacc.c:1646  */
    1495        1820 :     break;
    1496             : 
    1497             :   case 9:
    1498             : #line 148 "jsonpath_gram.y" /* yacc.c:1646  */
    1499             :     { (yyval.value) = makeItemString(&(yyvsp[0].str)); }
    1500             : #line 1501 "jsonpath_gram.c" /* yacc.c:1646  */
    1501         244 :     break;
    1502             : 
    1503             :   case 10:
    1504             : #line 149 "jsonpath_gram.y" /* yacc.c:1646  */
    1505             :     { (yyval.value) = makeItemString(NULL); }
    1506             : #line 1507 "jsonpath_gram.c" /* yacc.c:1646  */
    1507          76 :     break;
    1508             : 
    1509             :   case 11:
    1510             : #line 150 "jsonpath_gram.y" /* yacc.c:1646  */
    1511             :     { (yyval.value) = makeItemBool(true); }
    1512             : #line 1513 "jsonpath_gram.c" /* yacc.c:1646  */
    1513          92 :     break;
    1514             : 
    1515             :   case 12:
    1516             : #line 151 "jsonpath_gram.y" /* yacc.c:1646  */
    1517             :     { (yyval.value) = makeItemBool(false); }
    1518             : #line 1519 "jsonpath_gram.c" /* yacc.c:1646  */
    1519          12 :     break;
    1520             : 
    1521             :   case 13:
    1522             : #line 152 "jsonpath_gram.y" /* yacc.c:1646  */
    1523             :     { (yyval.value) = makeItemNumeric(&(yyvsp[0].str)); }
    1524             : #line 1525 "jsonpath_gram.c" /* yacc.c:1646  */
    1525         248 :     break;
    1526             : 
    1527             :   case 14:
    1528             : #line 153 "jsonpath_gram.y" /* yacc.c:1646  */
    1529             :     { (yyval.value) = makeItemNumeric(&(yyvsp[0].str)); }
    1530             : #line 1531 "jsonpath_gram.c" /* yacc.c:1646  */
    1531         800 :     break;
    1532             : 
    1533             :   case 15:
    1534             : #line 154 "jsonpath_gram.y" /* yacc.c:1646  */
    1535             :     { (yyval.value) = makeItemVariable(&(yyvsp[0].str)); }
    1536             : #line 1537 "jsonpath_gram.c" /* yacc.c:1646  */
    1537         176 :     break;
    1538             : 
    1539             :   case 16:
    1540             : #line 158 "jsonpath_gram.y" /* yacc.c:1646  */
    1541             :     { (yyval.optype) = jpiEqual; }
    1542             : #line 1543 "jsonpath_gram.c" /* yacc.c:1646  */
    1543         532 :     break;
    1544             : 
    1545             :   case 17:
    1546             : #line 159 "jsonpath_gram.y" /* yacc.c:1646  */
    1547             :     { (yyval.optype) = jpiNotEqual; }
    1548             : #line 1549 "jsonpath_gram.c" /* yacc.c:1646  */
    1549           8 :     break;
    1550             : 
    1551             :   case 18:
    1552             : #line 160 "jsonpath_gram.y" /* yacc.c:1646  */
    1553             :     { (yyval.optype) = jpiLess; }
    1554             : #line 1555 "jsonpath_gram.c" /* yacc.c:1646  */
    1555         272 :     break;
    1556             : 
    1557             :   case 19:
    1558             : #line 161 "jsonpath_gram.y" /* yacc.c:1646  */
    1559             :     { (yyval.optype) = jpiGreater; }
    1560             : #line 1561 "jsonpath_gram.c" /* yacc.c:1646  */
    1561         240 :     break;
    1562             : 
    1563             :   case 20:
    1564             : #line 162 "jsonpath_gram.y" /* yacc.c:1646  */
    1565             :     { (yyval.optype) = jpiLessOrEqual; }
    1566             : #line 1567 "jsonpath_gram.c" /* yacc.c:1646  */
    1567          12 :     break;
    1568             : 
    1569             :   case 21:
    1570             : #line 163 "jsonpath_gram.y" /* yacc.c:1646  */
    1571             :     { (yyval.optype) = jpiGreaterOrEqual; }
    1572             : #line 1573 "jsonpath_gram.c" /* yacc.c:1646  */
    1573          40 :     break;
    1574             : 
    1575             :   case 22:
    1576             : #line 167 "jsonpath_gram.y" /* yacc.c:1646  */
    1577             :     { (yyval.value) = (yyvsp[-1].value); }
    1578             : #line 1579 "jsonpath_gram.c" /* yacc.c:1646  */
    1579          48 :     break;
    1580             : 
    1581             :   case 23:
    1582             : #line 168 "jsonpath_gram.y" /* yacc.c:1646  */
    1583             :     { (yyval.value) = makeItemUnary(jpiExists, (yyvsp[-1].value)); }
    1584             : #line 1585 "jsonpath_gram.c" /* yacc.c:1646  */
    1585         176 :     break;
    1586             : 
    1587             :   case 24:
    1588             : #line 172 "jsonpath_gram.y" /* yacc.c:1646  */
    1589             :     { (yyval.value) = (yyvsp[0].value); }
    1590             : #line 1591 "jsonpath_gram.c" /* yacc.c:1646  */
    1591         208 :     break;
    1592             : 
    1593             :   case 25:
    1594             : #line 173 "jsonpath_gram.y" /* yacc.c:1646  */
    1595             :     { (yyval.value) = makeItemBinary((yyvsp[-1].optype), (yyvsp[-2].value), (yyvsp[0].value)); }
    1596             : #line 1597 "jsonpath_gram.c" /* yacc.c:1646  */
    1597        1056 :     break;
    1598             : 
    1599             :   case 26:
    1600             : #line 174 "jsonpath_gram.y" /* yacc.c:1646  */
    1601             :     { (yyval.value) = makeItemBinary(jpiAnd, (yyvsp[-2].value), (yyvsp[0].value)); }
    1602             : #line 1603 "jsonpath_gram.c" /* yacc.c:1646  */
    1603         112 :     break;
    1604             : 
    1605             :   case 27:
    1606             : #line 175 "jsonpath_gram.y" /* yacc.c:1646  */
    1607             :     { (yyval.value) = makeItemBinary(jpiOr, (yyvsp[-2].value), (yyvsp[0].value)); }
    1608             : #line 1609 "jsonpath_gram.c" /* yacc.c:1646  */
    1609          72 :     break;
    1610             : 
    1611             :   case 28:
    1612             : #line 176 "jsonpath_gram.y" /* yacc.c:1646  */
    1613             :     { (yyval.value) = makeItemUnary(jpiNot, (yyvsp[0].value)); }
    1614             : #line 1615 "jsonpath_gram.c" /* yacc.c:1646  */
    1615          16 :     break;
    1616             : 
    1617             :   case 29:
    1618             : #line 178 "jsonpath_gram.y" /* yacc.c:1646  */
    1619             :     { (yyval.value) = makeItemUnary(jpiIsUnknown, (yyvsp[-3].value)); }
    1620             : #line 1621 "jsonpath_gram.c" /* yacc.c:1646  */
    1621          48 :     break;
    1622             : 
    1623             :   case 30:
    1624             : #line 180 "jsonpath_gram.y" /* yacc.c:1646  */
    1625             :     { (yyval.value) = makeItemBinary(jpiStartsWith, (yyvsp[-3].value), (yyvsp[0].value)); }
    1626             : #line 1627 "jsonpath_gram.c" /* yacc.c:1646  */
    1627          40 :     break;
    1628             : 
    1629             :   case 31:
    1630             : #line 181 "jsonpath_gram.y" /* yacc.c:1646  */
    1631             :     { (yyval.value) = makeItemLikeRegex((yyvsp[-2].value), &(yyvsp[0].str), NULL); }
    1632             : #line 1633 "jsonpath_gram.c" /* yacc.c:1646  */
    1633           8 :     break;
    1634             : 
    1635             :   case 32:
    1636             : #line 183 "jsonpath_gram.y" /* yacc.c:1646  */
    1637             :     { (yyval.value) = makeItemLikeRegex((yyvsp[-4].value), &(yyvsp[-2].str), &(yyvsp[0].str)); }
    1638             : #line 1639 "jsonpath_gram.c" /* yacc.c:1646  */
    1639          32 :     break;
    1640             : 
    1641             :   case 33:
    1642             : #line 187 "jsonpath_gram.y" /* yacc.c:1646  */
    1643             :     { (yyval.value) = makeItemString(&(yyvsp[0].str)); }
    1644             : #line 1645 "jsonpath_gram.c" /* yacc.c:1646  */
    1645          36 :     break;
    1646             : 
    1647             :   case 34:
    1648             : #line 188 "jsonpath_gram.y" /* yacc.c:1646  */
    1649             :     { (yyval.value) = makeItemVariable(&(yyvsp[0].str)); }
    1650             : #line 1651 "jsonpath_gram.c" /* yacc.c:1646  */
    1651           4 :     break;
    1652             : 
    1653             :   case 35:
    1654             : #line 192 "jsonpath_gram.y" /* yacc.c:1646  */
    1655             :     { (yyval.value) = (yyvsp[0].value); }
    1656             : #line 1657 "jsonpath_gram.c" /* yacc.c:1646  */
    1657        1648 :     break;
    1658             : 
    1659             :   case 36:
    1660             : #line 193 "jsonpath_gram.y" /* yacc.c:1646  */
    1661             :     { (yyval.value) = makeItemType(jpiRoot); }
    1662             : #line 1663 "jsonpath_gram.c" /* yacc.c:1646  */
    1663        2164 :     break;
    1664             : 
    1665             :   case 37:
    1666             : #line 194 "jsonpath_gram.y" /* yacc.c:1646  */
    1667             :     { (yyval.value) = makeItemType(jpiCurrent); }
    1668             : #line 1669 "jsonpath_gram.c" /* yacc.c:1646  */
    1669        1108 :     break;
    1670             : 
    1671             :   case 38:
    1672             : #line 195 "jsonpath_gram.y" /* yacc.c:1646  */
    1673             :     { (yyval.value) = makeItemType(jpiLast); }
    1674             : #line 1675 "jsonpath_gram.c" /* yacc.c:1646  */
    1675          60 :     break;
    1676             : 
    1677             :   case 39:
    1678             : #line 199 "jsonpath_gram.y" /* yacc.c:1646  */
    1679             :     { (yyval.elems) = list_make1((yyvsp[0].value)); }
    1680             : #line 1681 "jsonpath_gram.c" /* yacc.c:1646  */
    1681        4980 :     break;
    1682             : 
    1683             :   case 40:
    1684             : #line 200 "jsonpath_gram.y" /* yacc.c:1646  */
    1685             :     { (yyval.elems) = list_make2((yyvsp[-2].value), (yyvsp[0].value)); }
    1686             : #line 1687 "jsonpath_gram.c" /* yacc.c:1646  */
    1687          52 :     break;
    1688             : 
    1689             :   case 41:
    1690             : #line 201 "jsonpath_gram.y" /* yacc.c:1646  */
    1691             :     { (yyval.elems) = list_make2((yyvsp[-2].value), (yyvsp[0].value)); }
    1692             : #line 1693 "jsonpath_gram.c" /* yacc.c:1646  */
    1693          20 :     break;
    1694             : 
    1695             :   case 42:
    1696             : #line 202 "jsonpath_gram.y" /* yacc.c:1646  */
    1697             :     { (yyval.elems) = lappend((yyvsp[-1].elems), (yyvsp[0].value)); }
    1698             : #line 1699 "jsonpath_gram.c" /* yacc.c:1646  */
    1699        3848 :     break;
    1700             : 
    1701             :   case 43:
    1702             : #line 206 "jsonpath_gram.y" /* yacc.c:1646  */
    1703             :     { (yyval.value) = makeItemList((yyvsp[0].elems)); }
    1704             : #line 1705 "jsonpath_gram.c" /* yacc.c:1646  */
    1705        4944 :     break;
    1706             : 
    1707             :   case 44:
    1708             : #line 207 "jsonpath_gram.y" /* yacc.c:1646  */
    1709             :     { (yyval.value) = (yyvsp[-1].value); }
    1710             : #line 1711 "jsonpath_gram.c" /* yacc.c:1646  */
    1711          48 :     break;
    1712             : 
    1713             :   case 45:
    1714             : #line 208 "jsonpath_gram.y" /* yacc.c:1646  */
    1715             :     { (yyval.value) = makeItemUnary(jpiPlus, (yyvsp[0].value)); }
    1716             : #line 1717 "jsonpath_gram.c" /* yacc.c:1646  */
    1717         100 :     break;
    1718             : 
    1719             :   case 46:
    1720             : #line 209 "jsonpath_gram.y" /* yacc.c:1646  */
    1721             :     { (yyval.value) = makeItemUnary(jpiMinus, (yyvsp[0].value)); }
    1722             : #line 1723 "jsonpath_gram.c" /* yacc.c:1646  */
    1723         148 :     break;
    1724             : 
    1725             :   case 47:
    1726             : #line 210 "jsonpath_gram.y" /* yacc.c:1646  */
    1727             :     { (yyval.value) = makeItemBinary(jpiAdd, (yyvsp[-2].value), (yyvsp[0].value)); }
    1728             : #line 1729 "jsonpath_gram.c" /* yacc.c:1646  */
    1729         100 :     break;
    1730             : 
    1731             :   case 48:
    1732             : #line 211 "jsonpath_gram.y" /* yacc.c:1646  */
    1733             :     { (yyval.value) = makeItemBinary(jpiSub, (yyvsp[-2].value), (yyvsp[0].value)); }
    1734             : #line 1735 "jsonpath_gram.c" /* yacc.c:1646  */
    1735          40 :     break;
    1736             : 
    1737             :   case 49:
    1738             : #line 212 "jsonpath_gram.y" /* yacc.c:1646  */
    1739             :     { (yyval.value) = makeItemBinary(jpiMul, (yyvsp[-2].value), (yyvsp[0].value)); }
    1740             : #line 1741 "jsonpath_gram.c" /* yacc.c:1646  */
    1741          32 :     break;
    1742             : 
    1743             :   case 50:
    1744             : #line 213 "jsonpath_gram.y" /* yacc.c:1646  */
    1745             :     { (yyval.value) = makeItemBinary(jpiDiv, (yyvsp[-2].value), (yyvsp[0].value)); }
    1746             : #line 1747 "jsonpath_gram.c" /* yacc.c:1646  */
    1747          24 :     break;
    1748             : 
    1749             :   case 51:
    1750             : #line 214 "jsonpath_gram.y" /* yacc.c:1646  */
    1751             :     { (yyval.value) = makeItemBinary(jpiMod, (yyvsp[-2].value), (yyvsp[0].value)); }
    1752             : #line 1753 "jsonpath_gram.c" /* yacc.c:1646  */
    1753          12 :     break;
    1754             : 
    1755             :   case 52:
    1756             : #line 218 "jsonpath_gram.y" /* yacc.c:1646  */
    1757             :     { (yyval.value) = makeItemBinary(jpiSubscript, (yyvsp[0].value), NULL); }
    1758             : #line 1759 "jsonpath_gram.c" /* yacc.c:1646  */
    1759         216 :     break;
    1760             : 
    1761             :   case 53:
    1762             : #line 219 "jsonpath_gram.y" /* yacc.c:1646  */
    1763             :     { (yyval.value) = makeItemBinary(jpiSubscript, (yyvsp[-2].value), (yyvsp[0].value)); }
    1764             : #line 1765 "jsonpath_gram.c" /* yacc.c:1646  */
    1765          28 :     break;
    1766             : 
    1767             :   case 54:
    1768             : #line 223 "jsonpath_gram.y" /* yacc.c:1646  */
    1769             :     { (yyval.indexs) = list_make1((yyvsp[0].value)); }
    1770             : #line 1771 "jsonpath_gram.c" /* yacc.c:1646  */
    1771         224 :     break;
    1772             : 
    1773             :   case 55:
    1774             : #line 224 "jsonpath_gram.y" /* yacc.c:1646  */
    1775             :     { (yyval.indexs) = lappend((yyvsp[-2].indexs), (yyvsp[0].value)); }
    1776             : #line 1777 "jsonpath_gram.c" /* yacc.c:1646  */
    1777          20 :     break;
    1778             : 
    1779             :   case 56:
    1780             : #line 228 "jsonpath_gram.y" /* yacc.c:1646  */
    1781             :     { (yyval.value) = makeItemType(jpiAnyArray); }
    1782             : #line 1783 "jsonpath_gram.c" /* yacc.c:1646  */
    1783         536 :     break;
    1784             : 
    1785             :   case 57:
    1786             : #line 229 "jsonpath_gram.y" /* yacc.c:1646  */
    1787             :     { (yyval.value) = makeIndexArray((yyvsp[-1].indexs)); }
    1788             : #line 1789 "jsonpath_gram.c" /* yacc.c:1646  */
    1789         224 :     break;
    1790             : 
    1791             :   case 58:
    1792             : #line 233 "jsonpath_gram.y" /* yacc.c:1646  */
    1793             :     { (yyval.integer) = pg_atoi((yyvsp[0].str).val, 4, 0); }
    1794             : #line 1795 "jsonpath_gram.c" /* yacc.c:1646  */
    1795         188 :     break;
    1796             : 
    1797             :   case 59:
    1798             : #line 234 "jsonpath_gram.y" /* yacc.c:1646  */
    1799             :     { (yyval.integer) = -1; }
    1800             : #line 1801 "jsonpath_gram.c" /* yacc.c:1646  */
    1801          64 :     break;
    1802             : 
    1803             :   case 60:
    1804             : #line 238 "jsonpath_gram.y" /* yacc.c:1646  */
    1805             :     { (yyval.value) = makeAny(0, -1); }
    1806             : #line 1807 "jsonpath_gram.c" /* yacc.c:1646  */
    1807          76 :     break;
    1808             : 
    1809             :   case 61:
    1810             : #line 239 "jsonpath_gram.y" /* yacc.c:1646  */
    1811             :     { (yyval.value) = makeAny((yyvsp[-1].integer), (yyvsp[-1].integer)); }
    1812             : #line 1813 "jsonpath_gram.c" /* yacc.c:1646  */
    1813          68 :     break;
    1814             : 
    1815             :   case 62:
    1816             : #line 241 "jsonpath_gram.y" /* yacc.c:1646  */
    1817             :     { (yyval.value) = makeAny((yyvsp[-3].integer), (yyvsp[-1].integer)); }
    1818             : #line 1819 "jsonpath_gram.c" /* yacc.c:1646  */
    1819          92 :     break;
    1820             : 
    1821             :   case 63:
    1822             : #line 245 "jsonpath_gram.y" /* yacc.c:1646  */
    1823             :     { (yyval.value) = (yyvsp[0].value); }
    1824             : #line 1825 "jsonpath_gram.c" /* yacc.c:1646  */
    1825        1700 :     break;
    1826             : 
    1827             :   case 64:
    1828             : #line 246 "jsonpath_gram.y" /* yacc.c:1646  */
    1829             :     { (yyval.value) = makeItemType(jpiAnyKey); }
    1830             : #line 1831 "jsonpath_gram.c" /* yacc.c:1646  */
    1831          56 :     break;
    1832             : 
    1833             :   case 65:
    1834             : #line 247 "jsonpath_gram.y" /* yacc.c:1646  */
    1835             :     { (yyval.value) = (yyvsp[0].value); }
    1836             : #line 1837 "jsonpath_gram.c" /* yacc.c:1646  */
    1837         760 :     break;
    1838             : 
    1839             :   case 66:
    1840             : #line 248 "jsonpath_gram.y" /* yacc.c:1646  */
    1841             :     { (yyval.value) = (yyvsp[0].value); }
    1842             : #line 1843 "jsonpath_gram.c" /* yacc.c:1646  */
    1843         236 :     break;
    1844             : 
    1845             :   case 67:
    1846             : #line 249 "jsonpath_gram.y" /* yacc.c:1646  */
    1847             :     { (yyval.value) = makeItemType((yyvsp[-2].optype)); }
    1848             : #line 1849 "jsonpath_gram.c" /* yacc.c:1646  */
    1849         292 :     break;
    1850             : 
    1851             :   case 68:
    1852             : #line 250 "jsonpath_gram.y" /* yacc.c:1646  */
    1853             :     { (yyval.value) = makeItemUnary(jpiFilter, (yyvsp[-1].value)); }
    1854             : #line 1855 "jsonpath_gram.c" /* yacc.c:1646  */
    1855         876 :     break;
    1856             : 
    1857             :   case 69:
    1858             : #line 254 "jsonpath_gram.y" /* yacc.c:1646  */
    1859             :     { (yyval.value) = makeItemKey(&(yyvsp[0].str)); }
    1860             : #line 1861 "jsonpath_gram.c" /* yacc.c:1646  */
    1861        1700 :     break;
    1862             : 
    1863             :   case 93:
    1864             : #line 284 "jsonpath_gram.y" /* yacc.c:1646  */
    1865             :     { (yyval.optype) = jpiAbs; }
    1866             : #line 1867 "jsonpath_gram.c" /* yacc.c:1646  */
    1867          28 :     break;
    1868             : 
    1869             :   case 94:
    1870             : #line 285 "jsonpath_gram.y" /* yacc.c:1646  */
    1871             :     { (yyval.optype) = jpiSize; }
    1872             : #line 1873 "jsonpath_gram.c" /* yacc.c:1646  */
    1873          20 :     break;
    1874             : 
    1875             :   case 95:
    1876             : #line 286 "jsonpath_gram.y" /* yacc.c:1646  */
    1877             :     { (yyval.optype) = jpiType; }
    1878             : #line 1879 "jsonpath_gram.c" /* yacc.c:1646  */
    1879          80 :     break;
    1880             : 
    1881             :   case 96:
    1882             : #line 287 "jsonpath_gram.y" /* yacc.c:1646  */
    1883             :     { (yyval.optype) = jpiFloor; }
    1884             : #line 1885 "jsonpath_gram.c" /* yacc.c:1646  */
    1885          20 :     break;
    1886             : 
    1887             :   case 97:
    1888             : #line 288 "jsonpath_gram.y" /* yacc.c:1646  */
    1889             :     { (yyval.optype) = jpiDouble; }
    1890             : #line 1891 "jsonpath_gram.c" /* yacc.c:1646  */
    1891          76 :     break;
    1892             : 
    1893             :   case 98:
    1894             : #line 289 "jsonpath_gram.y" /* yacc.c:1646  */
    1895             :     { (yyval.optype) = jpiCeiling; }
    1896             : #line 1897 "jsonpath_gram.c" /* yacc.c:1646  */
    1897          24 :     break;
    1898             : 
    1899             :   case 99:
    1900             : #line 290 "jsonpath_gram.y" /* yacc.c:1646  */
    1901             :     { (yyval.optype) = jpiKeyValue; }
    1902             : #line 1903 "jsonpath_gram.c" /* yacc.c:1646  */
    1903          44 :     break;
    1904             : 
    1905             : 
    1906             : #line 1907 "jsonpath_gram.c" /* yacc.c:1646  */
    1907        1700 :       default: break;
    1908             :     }
    1909             :   /* User semantic actions sometimes alter yychar, and that requires
    1910             :      that yytoken be updated with the new translation.  We take the
    1911             :      approach of translating immediately before every use of yytoken.
    1912             :      One alternative is translating here after every semantic action,
    1913             :      but that translation would be missed if the semantic action invokes
    1914             :      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
    1915             :      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
    1916             :      incorrect destructor might then be invoked immediately.  In the
    1917             :      case of YYERROR or YYBACKUP, subsequent parser actions might lead
    1918             :      to an incorrect destructor call or verbose syntax error message
    1919             :      before the lookahead is translated.  */
    1920             :   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
    1921             : 
    1922       40060 :   YYPOPSTACK (yylen);
    1923       40060 :   yylen = 0;
    1924             :   YY_STACK_PRINT (yyss, yyssp);
    1925             : 
    1926       40060 :   *++yyvsp = yyval;
    1927             : 
    1928             :   /* Now 'shift' the result of the reduction.  Determine what state
    1929             :      that goes to, based on the state we popped back to and the rule
    1930             :      number reduced by.  */
    1931             : 
    1932       40060 :   yyn = yyr1[yyn];
    1933             : 
    1934       40060 :   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
    1935       40060 :   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    1936        9812 :     yystate = yytable[yystate];
    1937             :   else
    1938       30248 :     yystate = yydefgoto[yyn - YYNTOKENS];
    1939             : 
    1940       40060 :   goto yynewstate;
    1941             : 
    1942             : 
    1943             : /*--------------------------------------.
    1944             : | yyerrlab -- here on detecting error.  |
    1945             : `--------------------------------------*/
    1946             : yyerrlab:
    1947             :   /* Make sure we have latest lookahead translation.  See comments at
    1948             :      user semantic actions for why this is necessary.  */
    1949          68 :   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
    1950             : 
    1951             :   /* If not already recovering from an error, report this error.  */
    1952          68 :   if (!yyerrstatus)
    1953             :     {
    1954          68 :       ++yynerrs;
    1955             : #if ! YYERROR_VERBOSE
    1956             :       yyerror (result, YY_("syntax error"));
    1957             : #else
    1958             : # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
    1959             :                                         yyssp, yytoken)
    1960             :       {
    1961          68 :         char const *yymsgp = YY_("syntax error");
    1962             :         int yysyntax_error_status;
    1963          68 :         yysyntax_error_status = YYSYNTAX_ERROR;
    1964          68 :         if (yysyntax_error_status == 0)
    1965          68 :           yymsgp = yymsg;
    1966           0 :         else if (yysyntax_error_status == 1)
    1967             :           {
    1968           0 :             if (yymsg != yymsgbuf)
    1969           0 :               YYSTACK_FREE (yymsg);
    1970           0 :             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
    1971           0 :             if (!yymsg)
    1972             :               {
    1973           0 :                 yymsg = yymsgbuf;
    1974           0 :                 yymsg_alloc = sizeof yymsgbuf;
    1975           0 :                 yysyntax_error_status = 2;
    1976             :               }
    1977             :             else
    1978             :               {
    1979           0 :                 yysyntax_error_status = YYSYNTAX_ERROR;
    1980           0 :                 yymsgp = yymsg;
    1981             :               }
    1982             :           }
    1983          68 :         yyerror (result, yymsgp);
    1984           0 :         if (yysyntax_error_status == 2)
    1985           0 :           goto yyexhaustedlab;
    1986             :       }
    1987             : # undef YYSYNTAX_ERROR
    1988             : #endif
    1989             :     }
    1990             : 
    1991             : 
    1992             : 
    1993           0 :   if (yyerrstatus == 3)
    1994             :     {
    1995             :       /* If just tried and failed to reuse lookahead token after an
    1996             :          error, discard it.  */
    1997             : 
    1998           0 :       if (yychar <= YYEOF)
    1999             :         {
    2000             :           /* Return failure if at end of input.  */
    2001           0 :           if (yychar == YYEOF)
    2002           0 :             YYABORT;
    2003             :         }
    2004             :       else
    2005             :         {
    2006           0 :           yydestruct ("Error: discarding",
    2007             :                       yytoken, &yylval, result);
    2008           0 :           yychar = YYEMPTY;
    2009             :         }
    2010             :     }
    2011             : 
    2012             :   /* Else will try to reuse lookahead token after shifting the error
    2013             :      token.  */
    2014           0 :   goto yyerrlab1;
    2015             : 
    2016             : 
    2017             : /*---------------------------------------------------.
    2018             : | yyerrorlab -- error raised explicitly by YYERROR.  |
    2019             : `---------------------------------------------------*/
    2020             : yyerrorlab:
    2021             : 
    2022             :   /* Pacify compilers like GCC when the user code never invokes
    2023             :      YYERROR and the label yyerrorlab therefore never appears in user
    2024             :      code.  */
    2025             :   if (/*CONSTCOND*/ 0)
    2026             :      goto yyerrorlab;
    2027             : 
    2028             :   /* Do not reclaim the symbols of the rule whose action triggered
    2029             :      this YYERROR.  */
    2030             :   YYPOPSTACK (yylen);
    2031             :   yylen = 0;
    2032             :   YY_STACK_PRINT (yyss, yyssp);
    2033             :   yystate = *yyssp;
    2034             :   goto yyerrlab1;
    2035             : 
    2036             : 
    2037             : /*-------------------------------------------------------------.
    2038             : | yyerrlab1 -- common code for both syntax error and YYERROR.  |
    2039             : `-------------------------------------------------------------*/
    2040             : yyerrlab1:
    2041           0 :   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
    2042             : 
    2043             :   for (;;)
    2044             :     {
    2045           0 :       yyn = yypact[yystate];
    2046           0 :       if (!yypact_value_is_default (yyn))
    2047             :         {
    2048           0 :           yyn += YYTERROR;
    2049           0 :           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
    2050             :             {
    2051           0 :               yyn = yytable[yyn];
    2052           0 :               if (0 < yyn)
    2053           0 :                 break;
    2054             :             }
    2055             :         }
    2056             : 
    2057             :       /* Pop the current state because it cannot handle the error token.  */
    2058           0 :       if (yyssp == yyss)
    2059           0 :         YYABORT;
    2060             : 
    2061             : 
    2062           0 :       yydestruct ("Error: popping",
    2063           0 :                   yystos[yystate], yyvsp, result);
    2064           0 :       YYPOPSTACK (1);
    2065           0 :       yystate = *yyssp;
    2066             :       YY_STACK_PRINT (yyss, yyssp);
    2067             :     }
    2068             : 
    2069             :   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
    2070           0 :   *++yyvsp = yylval;
    2071             :   YY_IGNORE_MAYBE_UNINITIALIZED_END
    2072             : 
    2073             : 
    2074             :   /* Shift the error token.  */
    2075             :   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
    2076             : 
    2077           0 :   yystate = yyn;
    2078           0 :   goto yynewstate;
    2079             : 
    2080             : 
    2081             : /*-------------------------------------.
    2082             : | yyacceptlab -- YYACCEPT comes here.  |
    2083             : `-------------------------------------*/
    2084             : yyacceptlab:
    2085        2224 :   yyresult = 0;
    2086        2224 :   goto yyreturn;
    2087             : 
    2088             : /*-----------------------------------.
    2089             : | yyabortlab -- YYABORT comes here.  |
    2090             : `-----------------------------------*/
    2091             : yyabortlab:
    2092           0 :   yyresult = 1;
    2093           0 :   goto yyreturn;
    2094             : 
    2095             : #if !defined yyoverflow || YYERROR_VERBOSE
    2096             : /*-------------------------------------------------.
    2097             : | yyexhaustedlab -- memory exhaustion comes here.  |
    2098             : `-------------------------------------------------*/
    2099             : yyexhaustedlab:
    2100           0 :   yyerror (result, YY_("memory exhausted"));
    2101           0 :   yyresult = 2;
    2102             :   /* Fall through.  */
    2103             : #endif
    2104             : 
    2105             : yyreturn:
    2106        2224 :   if (yychar != YYEMPTY)
    2107             :     {
    2108             :       /* Make sure we have latest lookahead translation.  See comments at
    2109             :          user semantic actions for why this is necessary.  */
    2110           0 :       yytoken = YYTRANSLATE (yychar);
    2111           0 :       yydestruct ("Cleanup: discarding lookahead",
    2112             :                   yytoken, &yylval, result);
    2113             :     }
    2114             :   /* Do not reclaim the symbols of the rule whose action triggered
    2115             :      this YYABORT or YYACCEPT.  */
    2116        2224 :   YYPOPSTACK (yylen);
    2117             :   YY_STACK_PRINT (yyss, yyssp);
    2118        8896 :   while (yyssp != yyss)
    2119             :     {
    2120        4448 :       yydestruct ("Cleanup: popping",
    2121        4448 :                   yystos[*yyssp], yyvsp, result);
    2122        4448 :       YYPOPSTACK (1);
    2123             :     }
    2124             : #ifndef yyoverflow
    2125        2224 :   if (yyss != yyssa)
    2126           0 :     YYSTACK_FREE (yyss);
    2127             : #endif
    2128             : #if YYERROR_VERBOSE
    2129        2224 :   if (yymsg != yymsgbuf)
    2130           0 :     YYSTACK_FREE (yymsg);
    2131             : #endif
    2132        2224 :   return yyresult;
    2133             : }
    2134             : #line 292 "jsonpath_gram.y" /* yacc.c:1906  */
    2135             : 
    2136             : 
    2137             : /*
    2138             :  * The helper functions below allocate and fill JsonPathParseItem's of various
    2139             :  * types.
    2140             :  */
    2141             : 
    2142             : static JsonPathParseItem *
    2143             : makeItemType(JsonPathItemType type)
    2144             : {
    2145             :     JsonPathParseItem  *v = palloc(sizeof(*v));
    2146             : 
    2147             :     CHECK_FOR_INTERRUPTS();
    2148             : 
    2149             :     v->type = type;
    2150             :     v->next = NULL;
    2151             : 
    2152             :     return v;
    2153             : }
    2154             : 
    2155             : static JsonPathParseItem *
    2156             : makeItemString(JsonPathString *s)
    2157             : {
    2158             :     JsonPathParseItem  *v;
    2159             : 
    2160             :     if (s == NULL)
    2161             :     {
    2162             :         v = makeItemType(jpiNull);
    2163             :     }
    2164             :     else
    2165             :     {
    2166             :         v = makeItemType(jpiString);
    2167             :         v->value.string.val = s->val;
    2168             :         v->value.string.len = s->len;
    2169             :     }
    2170             : 
    2171             :     return v;
    2172             : }
    2173             : 
    2174             : static JsonPathParseItem *
    2175             : makeItemVariable(JsonPathString *s)
    2176             : {
    2177             :     JsonPathParseItem  *v;
    2178             : 
    2179             :     v = makeItemType(jpiVariable);
    2180             :     v->value.string.val = s->val;
    2181             :     v->value.string.len = s->len;
    2182             : 
    2183             :     return v;
    2184             : }
    2185             : 
    2186             : static JsonPathParseItem *
    2187             : makeItemKey(JsonPathString *s)
    2188             : {
    2189             :     JsonPathParseItem  *v;
    2190             : 
    2191             :     v = makeItemString(s);
    2192             :     v->type = jpiKey;
    2193             : 
    2194             :     return v;
    2195             : }
    2196             : 
    2197             : static JsonPathParseItem *
    2198             : makeItemNumeric(JsonPathString *s)
    2199             : {
    2200             :     JsonPathParseItem  *v;
    2201             : 
    2202             :     v = makeItemType(jpiNumeric);
    2203             :     v->value.numeric =
    2204             :         DatumGetNumeric(DirectFunctionCall3(numeric_in,
    2205             :                                             CStringGetDatum(s->val),
    2206             :                                             ObjectIdGetDatum(InvalidOid),
    2207             :                                             Int32GetDatum(-1)));
    2208             : 
    2209             :     return v;
    2210             : }
    2211             : 
    2212             : static JsonPathParseItem *
    2213             : makeItemBool(bool val)
    2214             : {
    2215             :     JsonPathParseItem  *v = makeItemType(jpiBool);
    2216             : 
    2217             :     v->value.boolean = val;
    2218             : 
    2219             :     return v;
    2220             : }
    2221             : 
    2222             : static JsonPathParseItem *
    2223             : makeItemBinary(JsonPathItemType type, JsonPathParseItem *la, JsonPathParseItem *ra)
    2224             : {
    2225             :     JsonPathParseItem  *v = makeItemType(type);
    2226             : 
    2227             :     v->value.args.left = la;
    2228             :     v->value.args.right = ra;
    2229             : 
    2230             :     return v;
    2231             : }
    2232             : 
    2233             : static JsonPathParseItem *
    2234             : makeItemUnary(JsonPathItemType type, JsonPathParseItem *a)
    2235             : {
    2236             :     JsonPathParseItem  *v;
    2237             : 
    2238             :     if (type == jpiPlus && a->type == jpiNumeric && !a->next)
    2239             :         return a;
    2240             : 
    2241             :     if (type == jpiMinus && a->type == jpiNumeric && !a->next)
    2242             :     {
    2243             :         v = makeItemType(jpiNumeric);
    2244             :         v->value.numeric =
    2245             :             DatumGetNumeric(DirectFunctionCall1(numeric_uminus,
    2246             :                                                 NumericGetDatum(a->value.numeric)));
    2247             :         return v;
    2248             :     }
    2249             : 
    2250             :     v = makeItemType(type);
    2251             : 
    2252             :     v->value.arg = a;
    2253             : 
    2254             :     return v;
    2255             : }
    2256             : 
    2257             : static JsonPathParseItem *
    2258             : makeItemList(List *list)
    2259             : {
    2260             :     JsonPathParseItem  *head,
    2261             :                        *end;
    2262             :     ListCell           *cell = list_head(list);
    2263             : 
    2264             :     head = end = (JsonPathParseItem *) lfirst(cell);
    2265             : 
    2266             :     if (!lnext(cell))
    2267             :         return head;
    2268             : 
    2269             :     /* append items to the end of already existing list */
    2270             :     while (end->next)
    2271             :         end = end->next;
    2272             : 
    2273             :     for_each_cell(cell, lnext(cell))
    2274             :     {
    2275             :         JsonPathParseItem *c = (JsonPathParseItem *) lfirst(cell);
    2276             : 
    2277             :         end->next = c;
    2278             :         end = c;
    2279             :     }
    2280             : 
    2281             :     return head;
    2282             : }
    2283             : 
    2284             : static JsonPathParseItem *
    2285             : makeIndexArray(List *list)
    2286             : {
    2287             :     JsonPathParseItem  *v = makeItemType(jpiIndexArray);
    2288             :     ListCell           *cell;
    2289             :     int                 i = 0;
    2290             : 
    2291             :     Assert(list_length(list) > 0);
    2292             :     v->value.array.nelems = list_length(list);
    2293             : 
    2294             :     v->value.array.elems = palloc(sizeof(v->value.array.elems[0]) *
    2295             :                                   v->value.array.nelems);
    2296             : 
    2297             :     foreach(cell, list)
    2298             :     {
    2299             :         JsonPathParseItem  *jpi = lfirst(cell);
    2300             : 
    2301             :         Assert(jpi->type == jpiSubscript);
    2302             : 
    2303             :         v->value.array.elems[i].from = jpi->value.args.left;
    2304             :         v->value.array.elems[i++].to = jpi->value.args.right;
    2305             :     }
    2306             : 
    2307             :     return v;
    2308             : }
    2309             : 
    2310             : static JsonPathParseItem *
    2311             : makeAny(int first, int last)
    2312             : {
    2313             :     JsonPathParseItem  *v = makeItemType(jpiAny);
    2314             : 
    2315             :     v->value.anybounds.first = (first >= 0) ? first : PG_UINT32_MAX;
    2316             :     v->value.anybounds.last = (last >= 0) ? last : PG_UINT32_MAX;
    2317             : 
    2318             :     return v;
    2319             : }
    2320             : 
    2321             : static JsonPathParseItem *
    2322             : makeItemLikeRegex(JsonPathParseItem *expr, JsonPathString *pattern,
    2323             :                   JsonPathString *flags)
    2324             : {
    2325             :     JsonPathParseItem  *v = makeItemType(jpiLikeRegex);
    2326             :     int                 i;
    2327             :     int                 cflags = REG_ADVANCED;
    2328             : 
    2329             :     v->value.like_regex.expr = expr;
    2330             :     v->value.like_regex.pattern = pattern->val;
    2331             :     v->value.like_regex.patternlen = pattern->len;
    2332             :     v->value.like_regex.flags = 0;
    2333             : 
    2334             :     for (i = 0; flags && i < flags->len; i++)
    2335             :     {
    2336             :         switch (flags->val[i])
    2337             :         {
    2338             :             case 'i':
    2339             :                 v->value.like_regex.flags |= JSP_REGEX_ICASE;
    2340             :                 cflags |= REG_ICASE;
    2341             :                 break;
    2342             :             case 's':
    2343             :                 v->value.like_regex.flags &= ~JSP_REGEX_MLINE;
    2344             :                 v->value.like_regex.flags |= JSP_REGEX_SLINE;
    2345             :                 cflags |= REG_NEWLINE;
    2346             :                 break;
    2347             :             case 'm':
    2348             :                 v->value.like_regex.flags &= ~JSP_REGEX_SLINE;
    2349             :                 v->value.like_regex.flags |= JSP_REGEX_MLINE;
    2350             :                 cflags &= ~REG_NEWLINE;
    2351             :                 break;
    2352             :             case 'x':
    2353             :                 v->value.like_regex.flags |= JSP_REGEX_WSPACE;
    2354             :                 cflags |= REG_EXPANDED;
    2355             :                 break;
    2356             :             default:
    2357             :                 ereport(ERROR,
    2358             :                         (errcode(ERRCODE_SYNTAX_ERROR),
    2359             :                          errmsg("invalid input syntax for type %s", "jsonpath"),
    2360             :                          errdetail("unrecognized flag character \"%c\" in LIKE_REGEX predicate",
    2361             :                                    flags->val[i])));
    2362             :                 break;
    2363             :         }
    2364             :     }
    2365             : 
    2366             :     /* check regex validity */
    2367             :     (void) RE_compile_and_cache(cstring_to_text_with_len(pattern->val,
    2368             :                                                          pattern->len),
    2369             :                                 cflags, DEFAULT_COLLATION_OID);
    2370             : 
    2371             :     return v;
    2372             : }
    2373             : 
    2374             : /*
    2375             :  * jsonpath_scan.l is compiled as part of jsonpath_gram.y.  Currently, this is
    2376             :  * unavoidable because jsonpath_gram does not create a .h file to export its
    2377             :  * token symbols.  If these files ever grow large enough to be worth compiling
    2378             :  * separately, that could be fixed; but for now it seems like useless
    2379             :  * complication.
    2380             :  */
    2381             : 
    2382             : #include "jsonpath_scan.c"

Generated by: LCOV version 1.13