| 1 |
/* A Bison parser, made by GNU Bison 3.8.2. */ |
| 2 |
|
| 3 |
/* Bison implementation for Yacc-like parsers in C |
| 4 |
|
| 5 |
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, |
| 6 |
Inc. |
| 7 |
|
| 8 |
This program is free software: you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation, either version 3 of the License, or |
| 11 |
(at your option) any later version. |
| 12 |
|
| 13 |
This program is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 20 |
|
| 21 |
/* As a special exception, you may create a larger work that contains |
| 22 |
part or all of the Bison parser skeleton and distribute that work |
| 23 |
under terms of your choice, so long as that work isn't itself a |
| 24 |
parser generator using the skeleton or a modified version thereof |
| 25 |
as a parser skeleton. Alternatively, if you modify or redistribute |
| 26 |
the parser skeleton itself, you may (at your option) remove this |
| 27 |
special exception, which will cause the skeleton and the resulting |
| 28 |
Bison output files to be licensed under the GNU General Public |
| 29 |
License without this special exception. |
| 30 |
|
| 31 |
This special exception was added by the Free Software Foundation in |
| 32 |
version 2.2 of Bison. */ |
| 33 |
|
| 34 |
/* C LALR(1) parser skeleton written by Richard Stallman, by |
| 35 |
simplifying the original so-called "semantic" parser. */ |
| 36 |
|
| 37 |
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, |
| 38 |
especially those whose name start with YY_ or yy_. They are |
| 39 |
private implementation details that can be changed or removed. */ |
| 40 |
|
| 41 |
/* All symbols defined below should begin with yy or YY, to avoid |
| 42 |
infringing on user name space. This should be done even for local |
| 43 |
variables, as they might otherwise be expanded by user macros. |
| 44 |
There are some unavoidable exceptions within include files to |
| 45 |
define necessary library symbols; they are noted "INFRINGES ON |
| 46 |
USER NAME SPACE" below. */ |
| 47 |
|
| 48 |
/* Identify Bison output, and Bison version. */ |
| 49 |
#define YYBISON 30802 |
| 50 |
|
| 51 |
/* Bison version string. */ |
| 52 |
#define YYBISON_VERSION "3.8.2" |
| 53 |
|
| 54 |
/* Skeleton name. */ |
| 55 |
#define YYSKELETON_NAME "yacc.c" |
| 56 |
|
| 57 |
/* Pure parsers. */ |
| 58 |
#define YYPURE 2 |
| 59 |
|
| 60 |
/* Push parsers. */ |
| 61 |
#define YYPUSH 0 |
| 62 |
|
| 63 |
/* Pull parsers. */ |
| 64 |
#define YYPULL 1 |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
/* First part of user prologue. */ |
| 70 |
#line 1 "libsmartcols/src/filter-parser.y" |
| 71 |
|
| 72 |
/* |
| 73 |
* Compilers detect yynerrs as unused. Let's hope it will be fixed in future |
| 74 |
* versions of Bison. |
| 75 |
*/ |
| 76 |
#if defined(__GNUC__) && !defined(__clang__) |
| 77 |
# pragma GCC diagnostic ignored "-Wunused-but-set-variable" |
| 78 |
#elif defined(__clang__) |
| 79 |
# pragma clang diagnostic ignored "-Wunused-but-set-variable" |
| 80 |
#endif |
| 81 |
|
| 82 |
#include <stdio.h> |
| 83 |
|
| 84 |
#include "smartcolsP.h" |
| 85 |
#include "filter-parser.h" |
| 86 |
#include "filter-scanner.h" |
| 87 |
|
| 88 |
void yyerror(yyscan_t *locp, struct libscols_filter *fltr, char const *fmt, ...); |
| 89 |
|
| 90 |
|
| 91 |
#line 92 "libsmartcols/src/filter-parser.c" |
| 92 |
|
| 93 |
# ifndef YY_CAST |
| 94 |
# ifdef __cplusplus |
| 95 |
# define YY_CAST(Type, Val) static_cast<Type> (Val) |
| 96 |
# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) |
| 97 |
# else |
| 98 |
# define YY_CAST(Type, Val) ((Type) (Val)) |
| 99 |
# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
| 100 |
# endif |
| 101 |
# endif |
| 102 |
# ifndef YY_NULLPTR |
| 103 |
# if defined __cplusplus |
| 104 |
# if 201103L <= __cplusplus |
| 105 |
# define YY_NULLPTR nullptr |
| 106 |
# else |
| 107 |
# define YY_NULLPTR 0 |
| 108 |
# endif |
| 109 |
# else |
| 110 |
# define YY_NULLPTR ((void*)0) |
| 111 |
# endif |
| 112 |
# endif |
| 113 |
|
| 114 |
#include "filter-parser.h" |
| 115 |
/* Symbol kind. */ |
| 116 |
enum yysymbol_kind_t |
| 117 |
{ |
| 118 |
YYSYMBOL_YYEMPTY = -2, |
| 119 |
YYSYMBOL_YYEOF = 0, /* "end of file" */ |
| 120 |
YYSYMBOL_YYerror = 1, /* error */ |
| 121 |
YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ |
| 122 |
YYSYMBOL_T_NUMBER = 3, /* T_NUMBER */ |
| 123 |
YYSYMBOL_T_STRING = 4, /* T_STRING */ |
| 124 |
YYSYMBOL_T_HOLDER = 5, /* T_HOLDER */ |
| 125 |
YYSYMBOL_T_FLOAT = 6, /* T_FLOAT */ |
| 126 |
YYSYMBOL_T_OR = 7, /* T_OR */ |
| 127 |
YYSYMBOL_T_AND = 8, /* T_AND */ |
| 128 |
YYSYMBOL_T_EQ = 9, /* T_EQ */ |
| 129 |
YYSYMBOL_T_NE = 10, /* T_NE */ |
| 130 |
YYSYMBOL_T_LT = 11, /* T_LT */ |
| 131 |
YYSYMBOL_T_LE = 12, /* T_LE */ |
| 132 |
YYSYMBOL_T_GT = 13, /* T_GT */ |
| 133 |
YYSYMBOL_T_GE = 14, /* T_GE */ |
| 134 |
YYSYMBOL_T_REG = 15, /* T_REG */ |
| 135 |
YYSYMBOL_T_NREG = 16, /* T_NREG */ |
| 136 |
YYSYMBOL_T_TRUE = 17, /* T_TRUE */ |
| 137 |
YYSYMBOL_T_FALSE = 18, /* T_FALSE */ |
| 138 |
YYSYMBOL_T_NEG = 19, /* T_NEG */ |
| 139 |
YYSYMBOL_T_INVALID_NUMBER = 20, /* T_INVALID_NUMBER */ |
| 140 |
YYSYMBOL_21_ = 21, /* '(' */ |
| 141 |
YYSYMBOL_22_ = 22, /* ')' */ |
| 142 |
YYSYMBOL_YYACCEPT = 23, /* $accept */ |
| 143 |
YYSYMBOL_filter = 24, /* filter */ |
| 144 |
YYSYMBOL_expr = 25, /* expr */ |
| 145 |
YYSYMBOL_param = 26 /* param */ |
| 146 |
}; |
| 147 |
typedef enum yysymbol_kind_t yysymbol_kind_t; |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
#ifdef short |
| 153 |
# undef short |
| 154 |
#endif |
| 155 |
|
| 156 |
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure |
| 157 |
<limits.h> and (if available) <stdint.h> are included |
| 158 |
so that the code can choose integer types of a good width. */ |
| 159 |
|
| 160 |
#ifndef __PTRDIFF_MAX__ |
| 161 |
# include <limits.h> /* INFRINGES ON USER NAME SPACE */ |
| 162 |
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
| 163 |
# include <stdint.h> /* INFRINGES ON USER NAME SPACE */ |
| 164 |
# define YY_STDINT_H |
| 165 |
# endif |
| 166 |
#endif |
| 167 |
|
| 168 |
/* Narrow types that promote to a signed type and that can represent a |
| 169 |
signed or unsigned integer of at least N bits. In tables they can |
| 170 |
save space and decrease cache pressure. Promoting to a signed type |
| 171 |
helps avoid bugs in integer arithmetic. */ |
| 172 |
|
| 173 |
#ifdef __INT_LEAST8_MAX__ |
| 174 |
typedef __INT_LEAST8_TYPE__ yytype_int8; |
| 175 |
#elif defined YY_STDINT_H |
| 176 |
typedef int_least8_t yytype_int8; |
| 177 |
#else |
| 178 |
typedef signed char yytype_int8; |
| 179 |
#endif |
| 180 |
|
| 181 |
#ifdef __INT_LEAST16_MAX__ |
| 182 |
typedef __INT_LEAST16_TYPE__ yytype_int16; |
| 183 |
#elif defined YY_STDINT_H |
| 184 |
typedef int_least16_t yytype_int16; |
| 185 |
#else |
| 186 |
typedef short yytype_int16; |
| 187 |
#endif |
| 188 |
|
| 189 |
/* Work around bug in HP-UX 11.23, which defines these macros |
| 190 |
incorrectly for preprocessor constants. This workaround can likely |
| 191 |
be removed in 2023, as HPE has promised support for HP-UX 11.23 |
| 192 |
(aka HP-UX 11i v2) only through the end of 2022; see Table 2 of |
| 193 |
<https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ |
| 194 |
#ifdef __hpux |
| 195 |
# undef UINT_LEAST8_MAX |
| 196 |
# undef UINT_LEAST16_MAX |
| 197 |
# define UINT_LEAST8_MAX 255 |
| 198 |
# define UINT_LEAST16_MAX 65535 |
| 199 |
#endif |
| 200 |
|
| 201 |
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ |
| 202 |
typedef __UINT_LEAST8_TYPE__ yytype_uint8; |
| 203 |
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ |
| 204 |
&& UINT_LEAST8_MAX <= INT_MAX) |
| 205 |
typedef uint_least8_t yytype_uint8; |
| 206 |
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX |
| 207 |
typedef unsigned char yytype_uint8; |
| 208 |
#else |
| 209 |
typedef short yytype_uint8; |
| 210 |
#endif |
| 211 |
|
| 212 |
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ |
| 213 |
typedef __UINT_LEAST16_TYPE__ yytype_uint16; |
| 214 |
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ |
| 215 |
&& UINT_LEAST16_MAX <= INT_MAX) |
| 216 |
typedef uint_least16_t yytype_uint16; |
| 217 |
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX |
| 218 |
typedef unsigned short yytype_uint16; |
| 219 |
#else |
| 220 |
typedef int yytype_uint16; |
| 221 |
#endif |
| 222 |
|
| 223 |
#ifndef YYPTRDIFF_T |
| 224 |
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ |
| 225 |
# define YYPTRDIFF_T __PTRDIFF_TYPE__ |
| 226 |
# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ |
| 227 |
# elif defined PTRDIFF_MAX |
| 228 |
# ifndef ptrdiff_t |
| 229 |
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 230 |
# endif |
| 231 |
# define YYPTRDIFF_T ptrdiff_t |
| 232 |
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX |
| 233 |
# else |
| 234 |
# define YYPTRDIFF_T long |
| 235 |
# define YYPTRDIFF_MAXIMUM LONG_MAX |
| 236 |
# endif |
| 237 |
#endif |
| 238 |
|
| 239 |
#ifndef YYSIZE_T |
| 240 |
# ifdef __SIZE_TYPE__ |
| 241 |
# define YYSIZE_T __SIZE_TYPE__ |
| 242 |
# elif defined size_t |
| 243 |
# define YYSIZE_T size_t |
| 244 |
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
| 245 |
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 246 |
# define YYSIZE_T size_t |
| 247 |
# else |
| 248 |
# define YYSIZE_T unsigned |
| 249 |
# endif |
| 250 |
#endif |
| 251 |
|
| 252 |
#define YYSIZE_MAXIMUM \ |
| 253 |
YY_CAST (YYPTRDIFF_T, \ |
| 254 |
(YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ |
| 255 |
? YYPTRDIFF_MAXIMUM \ |
| 256 |
: YY_CAST (YYSIZE_T, -1))) |
| 257 |
|
| 258 |
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
| 259 |
|
| 260 |
|
| 261 |
/* Stored state numbers (used for stacks). */ |
| 262 |
typedef yytype_int8 yy_state_t; |
| 263 |
|
| 264 |
/* State numbers in computations. */ |
| 265 |
typedef int yy_state_fast_t; |
| 266 |
|
| 267 |
#ifndef YY_ |
| 268 |
# if defined YYENABLE_NLS && YYENABLE_NLS |
| 269 |
# if ENABLE_NLS |
| 270 |
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 271 |
# define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
| 272 |
# endif |
| 273 |
# endif |
| 274 |
# ifndef YY_ |
| 275 |
# define YY_(Msgid) Msgid |
| 276 |
# endif |
| 277 |
#endif |
| 278 |
|
| 279 |
|
| 280 |
#ifndef YY_ATTRIBUTE_PURE |
| 281 |
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) |
| 282 |
# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
| 283 |
# else |
| 284 |
# define YY_ATTRIBUTE_PURE |
| 285 |
# endif |
| 286 |
#endif |
| 287 |
|
| 288 |
#ifndef YY_ATTRIBUTE_UNUSED |
| 289 |
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) |
| 290 |
# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
| 291 |
# else |
| 292 |
# define YY_ATTRIBUTE_UNUSED |
| 293 |
# endif |
| 294 |
#endif |
| 295 |
|
| 296 |
/* Suppress unused-variable warnings by "using" E. */ |
| 297 |
#if ! defined lint || defined __GNUC__ |
| 298 |
# define YY_USE(E) ((void) (E)) |
| 299 |
#else |
| 300 |
# define YY_USE(E) /* empty */ |
| 301 |
#endif |
| 302 |
|
| 303 |
/* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
| 304 |
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ |
| 305 |
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 |
| 306 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
| 307 |
_Pragma ("GCC diagnostic push") \ |
| 308 |
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") |
| 309 |
# else |
| 310 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
| 311 |
_Pragma ("GCC diagnostic push") \ |
| 312 |
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ |
| 313 |
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
| 314 |
# endif |
| 315 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
| 316 |
_Pragma ("GCC diagnostic pop") |
| 317 |
#else |
| 318 |
# define YY_INITIAL_VALUE(Value) Value |
| 319 |
#endif |
| 320 |
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 321 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 322 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 323 |
#endif |
| 324 |
#ifndef YY_INITIAL_VALUE |
| 325 |
# define YY_INITIAL_VALUE(Value) /* Nothing. */ |
| 326 |
#endif |
| 327 |
|
| 328 |
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ |
| 329 |
# define YY_IGNORE_USELESS_CAST_BEGIN \ |
| 330 |
_Pragma ("GCC diagnostic push") \ |
| 331 |
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") |
| 332 |
# define YY_IGNORE_USELESS_CAST_END \ |
| 333 |
_Pragma ("GCC diagnostic pop") |
| 334 |
#endif |
| 335 |
#ifndef YY_IGNORE_USELESS_CAST_BEGIN |
| 336 |
# define YY_IGNORE_USELESS_CAST_BEGIN |
| 337 |
# define YY_IGNORE_USELESS_CAST_END |
| 338 |
#endif |
| 339 |
|
| 340 |
|
| 341 |
#define YY_ASSERT(E) ((void) (0 && (E))) |
| 342 |
|
| 343 |
#if 1 |
| 344 |
|
| 345 |
/* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 346 |
|
| 347 |
# ifdef YYSTACK_USE_ALLOCA |
| 348 |
# if YYSTACK_USE_ALLOCA |
| 349 |
# ifdef __GNUC__ |
| 350 |
# define YYSTACK_ALLOC __builtin_alloca |
| 351 |
# elif defined __BUILTIN_VA_ARG_INCR |
| 352 |
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 353 |
# elif defined _AIX |
| 354 |
# define YYSTACK_ALLOC __alloca |
| 355 |
# elif defined _MSC_VER |
| 356 |
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 357 |
# define alloca _alloca |
| 358 |
# else |
| 359 |
# define YYSTACK_ALLOC alloca |
| 360 |
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
| 361 |
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 362 |
/* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
| 363 |
# ifndef EXIT_SUCCESS |
| 364 |
# define EXIT_SUCCESS 0 |
| 365 |
# endif |
| 366 |
# endif |
| 367 |
# endif |
| 368 |
# endif |
| 369 |
# endif |
| 370 |
|
| 371 |
# ifdef YYSTACK_ALLOC |
| 372 |
/* Pacify GCC's 'empty if-body' warning. */ |
| 373 |
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 374 |
# ifndef YYSTACK_ALLOC_MAXIMUM |
| 375 |
/* The OS might guarantee only one guard page at the bottom of the stack, |
| 376 |
and a page size can be as small as 4096 bytes. So we cannot safely |
| 377 |
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 378 |
to allow for a few compiler-allocated temporary stack slots. */ |
| 379 |
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 380 |
# endif |
| 381 |
# else |
| 382 |
# define YYSTACK_ALLOC YYMALLOC |
| 383 |
# define YYSTACK_FREE YYFREE |
| 384 |
# ifndef YYSTACK_ALLOC_MAXIMUM |
| 385 |
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 386 |
# endif |
| 387 |
# if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
| 388 |
&& ! ((defined YYMALLOC || defined malloc) \ |
| 389 |
&& (defined YYFREE || defined free))) |
| 390 |
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 391 |
# ifndef EXIT_SUCCESS |
| 392 |
# define EXIT_SUCCESS 0 |
| 393 |
# endif |
| 394 |
# endif |
| 395 |
# ifndef YYMALLOC |
| 396 |
# define YYMALLOC malloc |
| 397 |
# if ! defined malloc && ! defined EXIT_SUCCESS |
| 398 |
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 399 |
# endif |
| 400 |
# endif |
| 401 |
# ifndef YYFREE |
| 402 |
# define YYFREE free |
| 403 |
# if ! defined free && ! defined EXIT_SUCCESS |
| 404 |
void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 405 |
# endif |
| 406 |
# endif |
| 407 |
# endif |
| 408 |
#endif /* 1 */ |
| 409 |
|
| 410 |
#if (! defined yyoverflow \ |
| 411 |
&& (! defined __cplusplus \ |
| 412 |
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 413 |
|
| 414 |
/* A type that is properly aligned for any stack member. */ |
| 415 |
union yyalloc |
| 416 |
{ |
| 417 |
yy_state_t yyss_alloc; |
| 418 |
YYSTYPE yyvs_alloc; |
| 419 |
}; |
| 420 |
|
| 421 |
/* The size of the maximum gap between one aligned stack and the next. */ |
| 422 |
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
| 423 |
|
| 424 |
/* The size of an array large to enough to hold all stacks, each with |
| 425 |
N elements. */ |
| 426 |
# define YYSTACK_BYTES(N) \ |
| 427 |
((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ |
| 428 |
+ YYSTACK_GAP_MAXIMUM) |
| 429 |
|
| 430 |
# define YYCOPY_NEEDED 1 |
| 431 |
|
| 432 |
/* Relocate STACK from its old location to the new one. The |
| 433 |
local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 434 |
elements in the stack, and YYPTR gives the new location of the |
| 435 |
stack. Advance YYPTR to a properly aligned location for the next |
| 436 |
stack. */ |
| 437 |
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
| 438 |
do \ |
| 439 |
{ \ |
| 440 |
YYPTRDIFF_T yynewbytes; \ |
| 441 |
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
| 442 |
Stack = &yyptr->Stack_alloc; \ |
| 443 |
yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 444 |
yyptr += yynewbytes / YYSIZEOF (*yyptr); \ |
| 445 |
} \ |
| 446 |
while (0) |
| 447 |
|
| 448 |
#endif |
| 449 |
|
| 450 |
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
| 451 |
/* Copy COUNT objects from SRC to DST. The source and destination do |
| 452 |
not overlap. */ |
| 453 |
# ifndef YYCOPY |
| 454 |
# if defined __GNUC__ && 1 < __GNUC__ |
| 455 |
# define YYCOPY(Dst, Src, Count) \ |
| 456 |
__builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) |
| 457 |
# else |
| 458 |
# define YYCOPY(Dst, Src, Count) \ |
| 459 |
do \ |
| 460 |
{ \ |
| 461 |
YYPTRDIFF_T yyi; \ |
| 462 |
for (yyi = 0; yyi < (Count); yyi++) \ |
| 463 |
(Dst)[yyi] = (Src)[yyi]; \ |
| 464 |
} \ |
| 465 |
while (0) |
| 466 |
# endif |
| 467 |
# endif |
| 468 |
#endif /* !YYCOPY_NEEDED */ |
| 469 |
|
| 470 |
/* YYFINAL -- State number of the termination state. */ |
| 471 |
#define YYFINAL 15 |
| 472 |
/* YYLAST -- Last index in YYTABLE. */ |
| 473 |
#define YYLAST 57 |
| 474 |
|
| 475 |
/* YYNTOKENS -- Number of terminals. */ |
| 476 |
#define YYNTOKENS 23 |
| 477 |
/* YYNNTS -- Number of nonterminals. */ |
| 478 |
#define YYNNTS 4 |
| 479 |
/* YYNRULES -- Number of rules. */ |
| 480 |
#define YYNRULES 22 |
| 481 |
/* YYNSTATES -- Number of states. */ |
| 482 |
#define YYNSTATES 37 |
| 483 |
|
| 484 |
/* YYMAXUTOK -- Last valid token kind. */ |
| 485 |
#define YYMAXUTOK 275 |
| 486 |
|
| 487 |
|
| 488 |
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM |
| 489 |
as returned by yylex, with out-of-bounds checking. */ |
| 490 |
#define YYTRANSLATE(YYX) \ |
| 491 |
(0 <= (YYX) && (YYX) <= YYMAXUTOK \ |
| 492 |
? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ |
| 493 |
: YYSYMBOL_YYUNDEF) |
| 494 |
|
| 495 |
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
| 496 |
as returned by yylex. */ |
| 497 |
static const yytype_int8 yytranslate[] = |
| 498 |
{ |
| 499 |
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 500 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 501 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 502 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 503 |
21, 22, 2, 2, 2, 2, 2, 2, 2, 2, |
| 504 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 505 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 506 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 507 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 508 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 509 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 510 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 511 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 512 |
2, 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, 2, 2, 2, 2, |
| 516 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 517 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 518 |
2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 522 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 523 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 524 |
2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 525 |
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 526 |
15, 16, 17, 18, 19, 20 |
| 527 |
}; |
| 528 |
|
| 529 |
#if YYDEBUG |
| 530 |
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
| 531 |
static const yytype_int8 yyrline[] = |
| 532 |
{ |
| 533 |
0, 76, 76, 80, 81, 82, 83, 84, 85, 86, |
| 534 |
87, 88, 89, 90, 92, 98, 106, 107, 108, 109, |
| 535 |
110, 114, 118 |
| 536 |
}; |
| 537 |
#endif |
| 538 |
|
| 539 |
/** Accessing symbol of state STATE. */ |
| 540 |
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) |
| 541 |
|
| 542 |
#if 1 |
| 543 |
/* The user-facing name of the symbol whose (internal) number is |
| 544 |
YYSYMBOL. No bounds checking. */ |
| 545 |
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; |
| 546 |
|
| 547 |
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 548 |
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 549 |
static const char *const yytname[] = |
| 550 |
{ |
| 551 |
"\"end of file\"", "error", "\"invalid token\"", "T_NUMBER", "T_STRING", |
| 552 |
"T_HOLDER", "T_FLOAT", "T_OR", "T_AND", "T_EQ", "T_NE", "T_LT", "T_LE", |
| 553 |
"T_GT", "T_GE", "T_REG", "T_NREG", "T_TRUE", "T_FALSE", "T_NEG", |
| 554 |
"T_INVALID_NUMBER", "'('", "')'", "$accept", "filter", "expr", "param", YY_NULLPTR |
| 555 |
}; |
| 556 |
|
| 557 |
static const char * |
| 558 |
yysymbol_name (yysymbol_kind_t yysymbol) |
| 559 |
{ |
| 560 |
return yytname[yysymbol]; |
| 561 |
} |
| 562 |
#endif |
| 563 |
|
| 564 |
#define YYPACT_NINF (-8) |
| 565 |
|
| 566 |
#define yypact_value_is_default(Yyn) \ |
| 567 |
((Yyn) == YYPACT_NINF) |
| 568 |
|
| 569 |
#define YYTABLE_NINF (-1) |
| 570 |
|
| 571 |
#define yytable_value_is_error(Yyn) \ |
| 572 |
0 |
| 573 |
|
| 574 |
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 575 |
STATE-NUM. */ |
| 576 |
static const yytype_int8 yypact[] = |
| 577 |
{ |
| 578 |
2, -8, -8, -8, -8, -8, -8, 2, -8, 2, |
| 579 |
1, 33, -8, -8, 17, -8, 2, 2, 2, 2, |
| 580 |
2, 2, 2, 2, 2, 2, -8, 41, 41, -8, |
| 581 |
-8, -8, -8, -8, -8, -8, -8 |
| 582 |
}; |
| 583 |
|
| 584 |
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
| 585 |
Performed when YYTABLE does not specify something else to do. Zero |
| 586 |
means the default is an error. */ |
| 587 |
static const yytype_int8 yydefact[] = |
| 588 |
{ |
| 589 |
0, 16, 19, 18, 17, 20, 21, 0, 22, 0, |
| 590 |
0, 2, 3, 7, 0, 1, 0, 0, 0, 0, |
| 591 |
0, 0, 0, 0, 0, 0, 4, 6, 5, 8, |
| 592 |
9, 11, 10, 13, 12, 14, 15 |
| 593 |
}; |
| 594 |
|
| 595 |
/* YYPGOTO[NTERM-NUM]. */ |
| 596 |
static const yytype_int8 yypgoto[] = |
| 597 |
{ |
| 598 |
-8, -8, -7, -8 |
| 599 |
}; |
| 600 |
|
| 601 |
/* YYDEFGOTO[NTERM-NUM]. */ |
| 602 |
static const yytype_int8 yydefgoto[] = |
| 603 |
{ |
| 604 |
0, 10, 11, 12 |
| 605 |
}; |
| 606 |
|
| 607 |
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
| 608 |
positive, shift that token. If negative, reduce the rule whose |
| 609 |
number is the opposite. If YYTABLE_NINF, syntax error. */ |
| 610 |
static const yytype_int8 yytable[] = |
| 611 |
{ |
| 612 |
13, 15, 14, 0, 0, 1, 2, 3, 4, 27, |
| 613 |
28, 29, 30, 31, 32, 33, 34, 35, 36, 5, |
| 614 |
6, 7, 8, 9, 16, 17, 18, 19, 20, 21, |
| 615 |
22, 23, 24, 25, 0, 0, 0, 0, 0, 26, |
| 616 |
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, |
| 617 |
18, 19, 20, 21, 22, 23, 24, 25 |
| 618 |
}; |
| 619 |
|
| 620 |
static const yytype_int8 yycheck[] = |
| 621 |
{ |
| 622 |
7, 0, 9, -1, -1, 3, 4, 5, 6, 16, |
| 623 |
17, 18, 19, 20, 21, 22, 23, 24, 25, 17, |
| 624 |
18, 19, 20, 21, 7, 8, 9, 10, 11, 12, |
| 625 |
13, 14, 15, 16, -1, -1, -1, -1, -1, 22, |
| 626 |
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 627 |
9, 10, 11, 12, 13, 14, 15, 16 |
| 628 |
}; |
| 629 |
|
| 630 |
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of |
| 631 |
state STATE-NUM. */ |
| 632 |
static const yytype_int8 yystos[] = |
| 633 |
{ |
| 634 |
0, 3, 4, 5, 6, 17, 18, 19, 20, 21, |
| 635 |
24, 25, 26, 25, 25, 0, 7, 8, 9, 10, |
| 636 |
11, 12, 13, 14, 15, 16, 22, 25, 25, 25, |
| 637 |
25, 25, 25, 25, 25, 25, 25 |
| 638 |
}; |
| 639 |
|
| 640 |
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ |
| 641 |
static const yytype_int8 yyr1[] = |
| 642 |
{ |
| 643 |
0, 23, 24, 25, 25, 25, 25, 25, 25, 25, |
| 644 |
25, 25, 25, 25, 25, 25, 26, 26, 26, 26, |
| 645 |
26, 26, 26 |
| 646 |
}; |
| 647 |
|
| 648 |
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ |
| 649 |
static const yytype_int8 yyr2[] = |
| 650 |
{ |
| 651 |
0, 2, 1, 1, 3, 3, 3, 2, 3, 3, |
| 652 |
3, 3, 3, 3, 3, 3, 1, 1, 1, 1, |
| 653 |
1, 1, 1 |
| 654 |
}; |
| 655 |
|
| 656 |
|
| 657 |
enum { YYENOMEM = -2 }; |
| 658 |
|
| 659 |
#define yyerrok (yyerrstatus = 0) |
| 660 |
#define yyclearin (yychar = YYEMPTY) |
| 661 |
|
| 662 |
#define YYACCEPT goto yyacceptlab |
| 663 |
#define YYABORT goto yyabortlab |
| 664 |
#define YYERROR goto yyerrorlab |
| 665 |
#define YYNOMEM goto yyexhaustedlab |
| 666 |
|
| 667 |
|
| 668 |
#define YYRECOVERING() (!!yyerrstatus) |
| 669 |
|
| 670 |
#define YYBACKUP(Token, Value) \ |
| 671 |
do \ |
| 672 |
if (yychar == YYEMPTY) \ |
| 673 |
{ \ |
| 674 |
yychar = (Token); \ |
| 675 |
yylval = (Value); \ |
| 676 |
YYPOPSTACK (yylen); \ |
| 677 |
yystate = *yyssp; \ |
| 678 |
goto yybackup; \ |
| 679 |
} \ |
| 680 |
else \ |
| 681 |
{ \ |
| 682 |
yyerror (scanner, fltr, YY_("syntax error: cannot back up")); \ |
| 683 |
YYERROR; \ |
| 684 |
} \ |
| 685 |
while (0) |
| 686 |
|
| 687 |
/* Backward compatibility with an undocumented macro. |
| 688 |
Use YYerror or YYUNDEF. */ |
| 689 |
#define YYERRCODE YYUNDEF |
| 690 |
|
| 691 |
|
| 692 |
/* Enable debugging if requested. */ |
| 693 |
#if YYDEBUG |
| 694 |
|
| 695 |
# ifndef YYFPRINTF |
| 696 |
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 697 |
# define YYFPRINTF fprintf |
| 698 |
# endif |
| 699 |
|
| 700 |
# define YYDPRINTF(Args) \ |
| 701 |
do { \ |
| 702 |
if (yydebug) \ |
| 703 |
YYFPRINTF Args; \ |
| 704 |
} while (0) |
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ |
| 710 |
do { \ |
| 711 |
if (yydebug) \ |
| 712 |
{ \ |
| 713 |
YYFPRINTF (stderr, "%s ", Title); \ |
| 714 |
yy_symbol_print (stderr, \ |
| 715 |
Kind, Value, scanner, fltr); \ |
| 716 |
YYFPRINTF (stderr, "\n"); \ |
| 717 |
} \ |
| 718 |
} while (0) |
| 719 |
|
| 720 |
|
| 721 |
/*-----------------------------------. |
| 722 |
| Print this symbol's value on YYO. | |
| 723 |
`-----------------------------------*/ |
| 724 |
|
| 725 |
static void |
| 726 |
yy_symbol_value_print (FILE *yyo, |
| 727 |
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *scanner, struct libscols_filter *fltr) |
| 728 |
{ |
| 729 |
FILE *yyoutput = yyo; |
| 730 |
YY_USE (yyoutput); |
| 731 |
YY_USE (scanner); |
| 732 |
YY_USE (fltr); |
| 733 |
if (!yyvaluep) |
| 734 |
return; |
| 735 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 736 |
YY_USE (yykind); |
| 737 |
YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 738 |
} |
| 739 |
|
| 740 |
|
| 741 |
/*---------------------------. |
| 742 |
| Print this symbol on YYO. | |
| 743 |
`---------------------------*/ |
| 744 |
|
| 745 |
static void |
| 746 |
yy_symbol_print (FILE *yyo, |
| 747 |
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *scanner, struct libscols_filter *fltr) |
| 748 |
{ |
| 749 |
YYFPRINTF (yyo, "%s %s (", |
| 750 |
yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); |
| 751 |
|
| 752 |
yy_symbol_value_print (yyo, yykind, yyvaluep, scanner, fltr); |
| 753 |
YYFPRINTF (yyo, ")"); |
| 754 |
} |
| 755 |
|
| 756 |
/*------------------------------------------------------------------. |
| 757 |
| yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 758 |
| TOP (included). | |
| 759 |
`------------------------------------------------------------------*/ |
| 760 |
|
| 761 |
static void |
| 762 |
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
| 763 |
{ |
| 764 |
YYFPRINTF (stderr, "Stack now"); |
| 765 |
for (; yybottom <= yytop; yybottom++) |
| 766 |
{ |
| 767 |
int yybot = *yybottom; |
| 768 |
YYFPRINTF (stderr, " %d", yybot); |
| 769 |
} |
| 770 |
YYFPRINTF (stderr, "\n"); |
| 771 |
} |
| 772 |
|
| 773 |
# define YY_STACK_PRINT(Bottom, Top) \ |
| 774 |
do { \ |
| 775 |
if (yydebug) \ |
| 776 |
yy_stack_print ((Bottom), (Top)); \ |
| 777 |
} while (0) |
| 778 |
|
| 779 |
|
| 780 |
/*------------------------------------------------. |
| 781 |
| Report that the YYRULE is going to be reduced. | |
| 782 |
`------------------------------------------------*/ |
| 783 |
|
| 784 |
static void |
| 785 |
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, |
| 786 |
int yyrule, void *scanner, struct libscols_filter *fltr) |
| 787 |
{ |
| 788 |
int yylno = yyrline[yyrule]; |
| 789 |
int yynrhs = yyr2[yyrule]; |
| 790 |
int yyi; |
| 791 |
YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", |
| 792 |
yyrule - 1, yylno); |
| 793 |
/* The symbols being reduced. */ |
| 794 |
for (yyi = 0; yyi < yynrhs; yyi++) |
| 795 |
{ |
| 796 |
YYFPRINTF (stderr, " $%d = ", yyi + 1); |
| 797 |
yy_symbol_print (stderr, |
| 798 |
YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), |
| 799 |
&yyvsp[(yyi + 1) - (yynrhs)], scanner, fltr); |
| 800 |
YYFPRINTF (stderr, "\n"); |
| 801 |
} |
| 802 |
} |
| 803 |
|
| 804 |
# define YY_REDUCE_PRINT(Rule) \ |
| 805 |
do { \ |
| 806 |
if (yydebug) \ |
| 807 |
yy_reduce_print (yyssp, yyvsp, Rule, scanner, fltr); \ |
| 808 |
} while (0) |
| 809 |
|
| 810 |
/* Nonzero means print parse trace. It is left uninitialized so that |
| 811 |
multiple parsers can coexist. */ |
| 812 |
int yydebug; |
| 813 |
#else /* !YYDEBUG */ |
| 814 |
# define YYDPRINTF(Args) ((void) 0) |
| 815 |
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) |
| 816 |
# define YY_STACK_PRINT(Bottom, Top) |
| 817 |
# define YY_REDUCE_PRINT(Rule) |
| 818 |
#endif /* !YYDEBUG */ |
| 819 |
|
| 820 |
|
| 821 |
/* YYINITDEPTH -- initial size of the parser's stacks. */ |
| 822 |
#ifndef YYINITDEPTH |
| 823 |
# define YYINITDEPTH 200 |
| 824 |
#endif |
| 825 |
|
| 826 |
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 827 |
if the built-in stack extension method is used). |
| 828 |
|
| 829 |
Do not make this value too large; the results are undefined if |
| 830 |
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 831 |
evaluated with infinite-precision integer arithmetic. */ |
| 832 |
|
| 833 |
#ifndef YYMAXDEPTH |
| 834 |
# define YYMAXDEPTH 10000 |
| 835 |
#endif |
| 836 |
|
| 837 |
|
| 838 |
/* Context of a parse error. */ |
| 839 |
typedef struct |
| 840 |
{ |
| 841 |
yy_state_t *yyssp; |
| 842 |
yysymbol_kind_t yytoken; |
| 843 |
} yypcontext_t; |
| 844 |
|
| 845 |
/* Put in YYARG at most YYARGN of the expected tokens given the |
| 846 |
current YYCTX, and return the number of tokens stored in YYARG. If |
| 847 |
YYARG is null, return the number of expected tokens (guaranteed to |
| 848 |
be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. |
| 849 |
Return 0 if there are more than YYARGN expected tokens, yet fill |
| 850 |
YYARG up to YYARGN. */ |
| 851 |
static int |
| 852 |
yypcontext_expected_tokens (const yypcontext_t *yyctx, |
| 853 |
yysymbol_kind_t yyarg[], int yyargn) |
| 854 |
{ |
| 855 |
/* Actual size of YYARG. */ |
| 856 |
int yycount = 0; |
| 857 |
int yyn = yypact[+*yyctx->yyssp]; |
| 858 |
if (!yypact_value_is_default (yyn)) |
| 859 |
{ |
| 860 |
/* Start YYX at -YYN if negative to avoid negative indexes in |
| 861 |
YYCHECK. In other words, skip the first -YYN actions for |
| 862 |
this state because they are default actions. */ |
| 863 |
int yyxbegin = yyn < 0 ? -yyn : 0; |
| 864 |
/* Stay within bounds of both yycheck and yytname. */ |
| 865 |
int yychecklim = YYLAST - yyn + 1; |
| 866 |
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 867 |
int yyx; |
| 868 |
for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 869 |
if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror |
| 870 |
&& !yytable_value_is_error (yytable[yyx + yyn])) |
| 871 |
{ |
| 872 |
if (!yyarg) |
| 873 |
++yycount; |
| 874 |
else if (yycount == yyargn) |
| 875 |
return 0; |
| 876 |
else |
| 877 |
yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); |
| 878 |
} |
| 879 |
} |
| 880 |
if (yyarg && yycount == 0 && 0 < yyargn) |
| 881 |
yyarg[0] = YYSYMBOL_YYEMPTY; |
| 882 |
return yycount; |
| 883 |
} |
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
#ifndef yystrlen |
| 889 |
# if defined __GLIBC__ && defined _STRING_H |
| 890 |
# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) |
| 891 |
# else |
| 892 |
/* Return the length of YYSTR. */ |
| 893 |
static YYPTRDIFF_T |
| 894 |
yystrlen (const char *yystr) |
| 895 |
{ |
| 896 |
YYPTRDIFF_T yylen; |
| 897 |
for (yylen = 0; yystr[yylen]; yylen++) |
| 898 |
continue; |
| 899 |
return yylen; |
| 900 |
} |
| 901 |
# endif |
| 902 |
#endif |
| 903 |
|
| 904 |
#ifndef yystpcpy |
| 905 |
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 906 |
# define yystpcpy stpcpy |
| 907 |
# else |
| 908 |
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 909 |
YYDEST. */ |
| 910 |
static char * |
| 911 |
yystpcpy (char *yydest, const char *yysrc) |
| 912 |
{ |
| 913 |
char *yyd = yydest; |
| 914 |
const char *yys = yysrc; |
| 915 |
|
| 916 |
while ((*yyd++ = *yys++) != '\0') |
| 917 |
continue; |
| 918 |
|
| 919 |
return yyd - 1; |
| 920 |
} |
| 921 |
# endif |
| 922 |
#endif |
| 923 |
|
| 924 |
#ifndef yytnamerr |
| 925 |
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 926 |
quotes and backslashes, so that it's suitable for yyerror. The |
| 927 |
heuristic is that double-quoting is unnecessary unless the string |
| 928 |
contains an apostrophe, a comma, or backslash (other than |
| 929 |
backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 930 |
null, do not copy; instead, return the length of what the result |
| 931 |
would have been. */ |
| 932 |
static YYPTRDIFF_T |
| 933 |
yytnamerr (char *yyres, const char *yystr) |
| 934 |
{ |
| 935 |
if (*yystr == '"') |
| 936 |
{ |
| 937 |
YYPTRDIFF_T yyn = 0; |
| 938 |
char const *yyp = yystr; |
| 939 |
for (;;) |
| 940 |
switch (*++yyp) |
| 941 |
{ |
| 942 |
case '\'': |
| 943 |
case ',': |
| 944 |
goto do_not_strip_quotes; |
| 945 |
|
| 946 |
case '\\': |
| 947 |
if (*++yyp != '\\') |
| 948 |
goto do_not_strip_quotes; |
| 949 |
else |
| 950 |
goto append; |
| 951 |
|
| 952 |
append: |
| 953 |
default: |
| 954 |
if (yyres) |
| 955 |
yyres[yyn] = *yyp; |
| 956 |
yyn++; |
| 957 |
break; |
| 958 |
|
| 959 |
case '"': |
| 960 |
if (yyres) |
| 961 |
yyres[yyn] = '\0'; |
| 962 |
return yyn; |
| 963 |
} |
| 964 |
do_not_strip_quotes: ; |
| 965 |
} |
| 966 |
|
| 967 |
if (yyres) |
| 968 |
return yystpcpy (yyres, yystr) - yyres; |
| 969 |
else |
| 970 |
return yystrlen (yystr); |
| 971 |
} |
| 972 |
#endif |
| 973 |
|
| 974 |
|
| 975 |
static int |
| 976 |
yy_syntax_error_arguments (const yypcontext_t *yyctx, |
| 977 |
yysymbol_kind_t yyarg[], int yyargn) |
| 978 |
{ |
| 979 |
/* Actual size of YYARG. */ |
| 980 |
int yycount = 0; |
| 981 |
/* There are many possibilities here to consider: |
| 982 |
- If this state is a consistent state with a default action, then |
| 983 |
the only way this function was invoked is if the default action |
| 984 |
is an error action. In that case, don't check for expected |
| 985 |
tokens because there are none. |
| 986 |
- The only way there can be no lookahead present (in yychar) is if |
| 987 |
this state is a consistent state with a default action. Thus, |
| 988 |
detecting the absence of a lookahead is sufficient to determine |
| 989 |
that there is no unexpected or expected token to report. In that |
| 990 |
case, just report a simple "syntax error". |
| 991 |
- Don't assume there isn't a lookahead just because this state is a |
| 992 |
consistent state with a default action. There might have been a |
| 993 |
previous inconsistent state, consistent state with a non-default |
| 994 |
action, or user semantic action that manipulated yychar. |
| 995 |
- Of course, the expected token list depends on states to have |
| 996 |
correct lookahead information, and it depends on the parser not |
| 997 |
to perform extra reductions after fetching a lookahead from the |
| 998 |
scanner and before detecting a syntax error. Thus, state merging |
| 999 |
(from LALR or IELR) and default reductions corrupt the expected |
| 1000 |
token list. However, the list is correct for canonical LR with |
| 1001 |
one exception: it will still contain any token that will not be |
| 1002 |
accepted due to an error action in a later state. |
| 1003 |
*/ |
| 1004 |
if (yyctx->yytoken != YYSYMBOL_YYEMPTY) |
| 1005 |
{ |
| 1006 |
int yyn; |
| 1007 |
if (yyarg) |
| 1008 |
yyarg[yycount] = yyctx->yytoken; |
| 1009 |
++yycount; |
| 1010 |
yyn = yypcontext_expected_tokens (yyctx, |
| 1011 |
yyarg ? yyarg + 1 : yyarg, yyargn - 1); |
| 1012 |
if (yyn == YYENOMEM) |
| 1013 |
return YYENOMEM; |
| 1014 |
else |
| 1015 |
yycount += yyn; |
| 1016 |
} |
| 1017 |
return yycount; |
| 1018 |
} |
| 1019 |
|
| 1020 |
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
| 1021 |
about the unexpected token YYTOKEN for the state stack whose top is |
| 1022 |
YYSSP. |
| 1023 |
|
| 1024 |
Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is |
| 1025 |
not large enough to hold the message. In that case, also set |
| 1026 |
*YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the |
| 1027 |
required number of bytes is too large to store. */ |
| 1028 |
static int |
| 1029 |
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, |
| 1030 |
const yypcontext_t *yyctx) |
| 1031 |
{ |
| 1032 |
enum { YYARGS_MAX = 5 }; |
| 1033 |
/* Internationalized format string. */ |
| 1034 |
const char *yyformat = YY_NULLPTR; |
| 1035 |
/* Arguments of yyformat: reported tokens (one for the "unexpected", |
| 1036 |
one per "expected"). */ |
| 1037 |
yysymbol_kind_t yyarg[YYARGS_MAX]; |
| 1038 |
/* Cumulated lengths of YYARG. */ |
| 1039 |
YYPTRDIFF_T yysize = 0; |
| 1040 |
|
| 1041 |
/* Actual size of YYARG. */ |
| 1042 |
int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); |
| 1043 |
if (yycount == YYENOMEM) |
| 1044 |
return YYENOMEM; |
| 1045 |
|
| 1046 |
switch (yycount) |
| 1047 |
{ |
| 1048 |
#define YYCASE_(N, S) \ |
| 1049 |
case N: \ |
| 1050 |
yyformat = S; \ |
| 1051 |
break |
| 1052 |
default: /* Avoid compiler warnings. */ |
| 1053 |
YYCASE_(0, YY_("syntax error")); |
| 1054 |
YYCASE_(1, YY_("syntax error, unexpected %s")); |
| 1055 |
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
| 1056 |
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
| 1057 |
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
| 1058 |
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
| 1059 |
#undef YYCASE_ |
| 1060 |
} |
| 1061 |
|
| 1062 |
/* Compute error message size. Don't count the "%s"s, but reserve |
| 1063 |
room for the terminator. */ |
| 1064 |
yysize = yystrlen (yyformat) - 2 * yycount + 1; |
| 1065 |
{ |
| 1066 |
int yyi; |
| 1067 |
for (yyi = 0; yyi < yycount; ++yyi) |
| 1068 |
{ |
| 1069 |
YYPTRDIFF_T yysize1 |
| 1070 |
= yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); |
| 1071 |
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) |
| 1072 |
yysize = yysize1; |
| 1073 |
else |
| 1074 |
return YYENOMEM; |
| 1075 |
} |
| 1076 |
} |
| 1077 |
|
| 1078 |
if (*yymsg_alloc < yysize) |
| 1079 |
{ |
| 1080 |
*yymsg_alloc = 2 * yysize; |
| 1081 |
if (! (yysize <= *yymsg_alloc |
| 1082 |
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 1083 |
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
| 1084 |
return -1; |
| 1085 |
} |
| 1086 |
|
| 1087 |
/* Avoid sprintf, as that infringes on the user's name space. |
| 1088 |
Don't have undefined behavior even if the translation |
| 1089 |
produced a string with the wrong number of "%s"s. */ |
| 1090 |
{ |
| 1091 |
char *yyp = *yymsg; |
| 1092 |
int yyi = 0; |
| 1093 |
while ((*yyp = *yyformat) != '\0') |
| 1094 |
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
| 1095 |
{ |
| 1096 |
yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); |
| 1097 |
yyformat += 2; |
| 1098 |
} |
| 1099 |
else |
| 1100 |
{ |
| 1101 |
++yyp; |
| 1102 |
++yyformat; |
| 1103 |
} |
| 1104 |
} |
| 1105 |
return 0; |
| 1106 |
} |
| 1107 |
|
| 1108 |
|
| 1109 |
/*-----------------------------------------------. |
| 1110 |
| Release the memory associated to this symbol. | |
| 1111 |
`-----------------------------------------------*/ |
| 1112 |
|
| 1113 |
static void |
| 1114 |
yydestruct (const char *yymsg, |
| 1115 |
yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void *scanner, struct libscols_filter *fltr) |
| 1116 |
{ |
| 1117 |
YY_USE (yyvaluep); |
| 1118 |
YY_USE (scanner); |
| 1119 |
YY_USE (fltr); |
| 1120 |
if (!yymsg) |
| 1121 |
yymsg = "Deleting"; |
| 1122 |
YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); |
| 1123 |
|
| 1124 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1125 |
switch (yykind) |
| 1126 |
{ |
| 1127 |
case YYSYMBOL_expr: /* expr */ |
| 1128 |
#line 63 "libsmartcols/src/filter-parser.y" |
| 1129 |
{ |
| 1130 |
/* This destruct is called on error. The root node will be deallocated |
| 1131 |
* by scols_unref_filter(). |
| 1132 |
*/ |
| 1133 |
if (fltr->root != ((*yyvaluep).param)) |
| 1134 |
filter_unref_node(((*yyvaluep).param)); |
| 1135 |
} |
| 1136 |
#line 1137 "libsmartcols/src/filter-parser.c" |
| 1137 |
break; |
| 1138 |
|
| 1139 |
case YYSYMBOL_param: /* param */ |
| 1140 |
#line 63 "libsmartcols/src/filter-parser.y" |
| 1141 |
{ |
| 1142 |
/* This destruct is called on error. The root node will be deallocated |
| 1143 |
* by scols_unref_filter(). |
| 1144 |
*/ |
| 1145 |
if (fltr->root != ((*yyvaluep).param)) |
| 1146 |
filter_unref_node(((*yyvaluep).param)); |
| 1147 |
} |
| 1148 |
#line 1149 "libsmartcols/src/filter-parser.c" |
| 1149 |
break; |
| 1150 |
|
| 1151 |
default: |
| 1152 |
break; |
| 1153 |
} |
| 1154 |
YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1155 |
} |
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
|
| 1161 |
|
| 1162 |
/*----------. |
| 1163 |
| yyparse. | |
| 1164 |
`----------*/ |
| 1165 |
|
| 1166 |
int |
| 1167 |
yyparse (void *scanner, struct libscols_filter *fltr) |
| 1168 |
{ |
| 1169 |
/* Lookahead token kind. */ |
| 1170 |
int yychar; |
| 1171 |
|
| 1172 |
|
| 1173 |
/* The semantic value of the lookahead symbol. */ |
| 1174 |
/* Default value used for initialization, for pacifying older GCCs |
| 1175 |
or non-GCC compilers. */ |
| 1176 |
YY_INITIAL_VALUE (static YYSTYPE yyval_default;) |
| 1177 |
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); |
| 1178 |
|
| 1179 |
/* Number of syntax errors so far. */ |
| 1180 |
int yynerrs = 0; |
| 1181 |
|
| 1182 |
yy_state_fast_t yystate = 0; |
| 1183 |
/* Number of tokens to shift before error messages enabled. */ |
| 1184 |
int yyerrstatus = 0; |
| 1185 |
|
| 1186 |
/* Refer to the stacks through separate pointers, to allow yyoverflow |
| 1187 |
to reallocate them elsewhere. */ |
| 1188 |
|
| 1189 |
/* Their size. */ |
| 1190 |
YYPTRDIFF_T yystacksize = YYINITDEPTH; |
| 1191 |
|
| 1192 |
/* The state stack: array, bottom, top. */ |
| 1193 |
yy_state_t yyssa[YYINITDEPTH]; |
| 1194 |
yy_state_t *yyss = yyssa; |
| 1195 |
yy_state_t *yyssp = yyss; |
| 1196 |
|
| 1197 |
/* The semantic value stack: array, bottom, top. */ |
| 1198 |
YYSTYPE yyvsa[YYINITDEPTH]; |
| 1199 |
YYSTYPE *yyvs = yyvsa; |
| 1200 |
YYSTYPE *yyvsp = yyvs; |
| 1201 |
|
| 1202 |
int yyn; |
| 1203 |
/* The return value of yyparse. */ |
| 1204 |
int yyresult; |
| 1205 |
/* Lookahead symbol kind. */ |
| 1206 |
yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; |
| 1207 |
/* The variables used to return semantic value and location from the |
| 1208 |
action routines. */ |
| 1209 |
YYSTYPE yyval; |
| 1210 |
|
| 1211 |
/* Buffer for error messages, and its allocated size. */ |
| 1212 |
char yymsgbuf[128]; |
| 1213 |
char *yymsg = yymsgbuf; |
| 1214 |
YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; |
| 1215 |
|
| 1216 |
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 1217 |
|
| 1218 |
/* The number of symbols on the RHS of the reduced rule. |
| 1219 |
Keep to zero when no symbol should be popped. */ |
| 1220 |
int yylen = 0; |
| 1221 |
|
| 1222 |
YYDPRINTF ((stderr, "Starting parse\n")); |
| 1223 |
|
| 1224 |
yychar = YYEMPTY; /* Cause a token to be read. */ |
| 1225 |
|
| 1226 |
goto yysetstate; |
| 1227 |
|
| 1228 |
|
| 1229 |
/*------------------------------------------------------------. |
| 1230 |
| yynewstate -- push a new state, which is found in yystate. | |
| 1231 |
`------------------------------------------------------------*/ |
| 1232 |
yynewstate: |
| 1233 |
/* In all cases, when you get here, the value and location stacks |
| 1234 |
have just been pushed. So pushing a state here evens the stacks. */ |
| 1235 |
yyssp++; |
| 1236 |
|
| 1237 |
|
| 1238 |
/*--------------------------------------------------------------------. |
| 1239 |
| yysetstate -- set current state (the top of the stack) to yystate. | |
| 1240 |
`--------------------------------------------------------------------*/ |
| 1241 |
yysetstate: |
| 1242 |
YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 1243 |
YY_ASSERT (0 <= yystate && yystate < YYNSTATES); |
| 1244 |
YY_IGNORE_USELESS_CAST_BEGIN |
| 1245 |
*yyssp = YY_CAST (yy_state_t, yystate); |
| 1246 |
YY_IGNORE_USELESS_CAST_END |
| 1247 |
YY_STACK_PRINT (yyss, yyssp); |
| 1248 |
|
| 1249 |
if (yyss + yystacksize - 1 <= yyssp) |
| 1250 |
#if !defined yyoverflow && !defined YYSTACK_RELOCATE |
| 1251 |
YYNOMEM; |
| 1252 |
#else |
| 1253 |
{ |
| 1254 |
/* Get the current used size of the three stacks, in elements. */ |
| 1255 |
YYPTRDIFF_T yysize = yyssp - yyss + 1; |
| 1256 |
|
| 1257 |
# if defined yyoverflow |
| 1258 |
{ |
| 1259 |
/* Give user a chance to reallocate the stack. Use copies of |
| 1260 |
these so that the &'s don't force the real ones into |
| 1261 |
memory. */ |
| 1262 |
yy_state_t *yyss1 = yyss; |
| 1263 |
YYSTYPE *yyvs1 = yyvs; |
| 1264 |
|
| 1265 |
/* Each stack pointer address is followed by the size of the |
| 1266 |
data in use in that stack, in bytes. This used to be a |
| 1267 |
conditional around just the two extra args, but that might |
| 1268 |
be undefined if yyoverflow is a macro. */ |
| 1269 |
yyoverflow (YY_("memory exhausted"), |
| 1270 |
&yyss1, yysize * YYSIZEOF (*yyssp), |
| 1271 |
&yyvs1, yysize * YYSIZEOF (*yyvsp), |
| 1272 |
&yystacksize); |
| 1273 |
yyss = yyss1; |
| 1274 |
yyvs = yyvs1; |
| 1275 |
} |
| 1276 |
# else /* defined YYSTACK_RELOCATE */ |
| 1277 |
/* Extend the stack our own way. */ |
| 1278 |
if (YYMAXDEPTH <= yystacksize) |
| 1279 |
YYNOMEM; |
| 1280 |
yystacksize *= 2; |
| 1281 |
if (YYMAXDEPTH < yystacksize) |
| 1282 |
yystacksize = YYMAXDEPTH; |
| 1283 |
|
| 1284 |
{ |
| 1285 |
yy_state_t *yyss1 = yyss; |
| 1286 |
union yyalloc *yyptr = |
| 1287 |
YY_CAST (union yyalloc *, |
| 1288 |
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); |
| 1289 |
if (! yyptr) |
| 1290 |
YYNOMEM; |
| 1291 |
YYSTACK_RELOCATE (yyss_alloc, yyss); |
| 1292 |
YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
| 1293 |
# undef YYSTACK_RELOCATE |
| 1294 |
if (yyss1 != yyssa) |
| 1295 |
YYSTACK_FREE (yyss1); |
| 1296 |
} |
| 1297 |
# endif |
| 1298 |
|
| 1299 |
yyssp = yyss + yysize - 1; |
| 1300 |
yyvsp = yyvs + yysize - 1; |
| 1301 |
|
| 1302 |
YY_IGNORE_USELESS_CAST_BEGIN |
| 1303 |
YYDPRINTF ((stderr, "Stack size increased to %ld\n", |
| 1304 |
YY_CAST (long, yystacksize))); |
| 1305 |
YY_IGNORE_USELESS_CAST_END |
| 1306 |
|
| 1307 |
if (yyss + yystacksize - 1 <= yyssp) |
| 1308 |
YYABORT; |
| 1309 |
} |
| 1310 |
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ |
| 1311 |
|
| 1312 |
|
| 1313 |
if (yystate == YYFINAL) |
| 1314 |
YYACCEPT; |
| 1315 |
|
| 1316 |
goto yybackup; |
| 1317 |
|
| 1318 |
|
| 1319 |
/*-----------. |
| 1320 |
| yybackup. | |
| 1321 |
`-----------*/ |
| 1322 |
yybackup: |
| 1323 |
/* Do appropriate processing given the current state. Read a |
| 1324 |
lookahead token if we need one and don't already have one. */ |
| 1325 |
|
| 1326 |
/* First try to decide what to do without reference to lookahead token. */ |
| 1327 |
yyn = yypact[yystate]; |
| 1328 |
if (yypact_value_is_default (yyn)) |
| 1329 |
goto yydefault; |
| 1330 |
|
| 1331 |
/* Not known => get a lookahead token if don't already have one. */ |
| 1332 |
|
| 1333 |
/* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ |
| 1334 |
if (yychar == YYEMPTY) |
| 1335 |
{ |
| 1336 |
YYDPRINTF ((stderr, "Reading a token\n")); |
| 1337 |
yychar = yylex (&yylval, scanner); |
| 1338 |
} |
| 1339 |
|
| 1340 |
if (yychar <= YYEOF) |
| 1341 |
{ |
| 1342 |
yychar = YYEOF; |
| 1343 |
yytoken = YYSYMBOL_YYEOF; |
| 1344 |
YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 1345 |
} |
| 1346 |
else if (yychar == YYerror) |
| 1347 |
{ |
| 1348 |
/* The scanner already issued an error message, process directly |
| 1349 |
to error recovery. But do not keep the error token as |
| 1350 |
lookahead, it is too special and may lead us to an endless |
| 1351 |
loop in error recovery. */ |
| 1352 |
yychar = YYUNDEF; |
| 1353 |
yytoken = YYSYMBOL_YYerror; |
| 1354 |
goto yyerrlab1; |
| 1355 |
} |
| 1356 |
else |
| 1357 |
{ |
| 1358 |
yytoken = YYTRANSLATE (yychar); |
| 1359 |
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
| 1360 |
} |
| 1361 |
|
| 1362 |
/* If the proper action on seeing token YYTOKEN is to reduce or to |
| 1363 |
detect an error, take that action. */ |
| 1364 |
yyn += yytoken; |
| 1365 |
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
| 1366 |
goto yydefault; |
| 1367 |
yyn = yytable[yyn]; |
| 1368 |
if (yyn <= 0) |
| 1369 |
{ |
| 1370 |
if (yytable_value_is_error (yyn)) |
| 1371 |
goto yyerrlab; |
| 1372 |
yyn = -yyn; |
| 1373 |
goto yyreduce; |
| 1374 |
} |
| 1375 |
|
| 1376 |
/* Count tokens shifted since error; after three, turn off error |
| 1377 |
status. */ |
| 1378 |
if (yyerrstatus) |
| 1379 |
yyerrstatus--; |
| 1380 |
|
| 1381 |
/* Shift the lookahead token. */ |
| 1382 |
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
| 1383 |
yystate = yyn; |
| 1384 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1385 |
*++yyvsp = yylval; |
| 1386 |
YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1387 |
|
| 1388 |
/* Discard the shifted token. */ |
| 1389 |
yychar = YYEMPTY; |
| 1390 |
goto yynewstate; |
| 1391 |
|
| 1392 |
|
| 1393 |
/*-----------------------------------------------------------. |
| 1394 |
| yydefault -- do the default action for the current state. | |
| 1395 |
`-----------------------------------------------------------*/ |
| 1396 |
yydefault: |
| 1397 |
yyn = yydefact[yystate]; |
| 1398 |
if (yyn == 0) |
| 1399 |
goto yyerrlab; |
| 1400 |
goto yyreduce; |
| 1401 |
|
| 1402 |
|
| 1403 |
/*-----------------------------. |
| 1404 |
| yyreduce -- do a reduction. | |
| 1405 |
`-----------------------------*/ |
| 1406 |
yyreduce: |
| 1407 |
/* yyn is the number of a rule to reduce with. */ |
| 1408 |
yylen = yyr2[yyn]; |
| 1409 |
|
| 1410 |
/* If YYLEN is nonzero, implement the default value of the action: |
| 1411 |
'$$ = $1'. |
| 1412 |
|
| 1413 |
Otherwise, the following line sets YYVAL to garbage. |
| 1414 |
This behavior is undocumented and Bison |
| 1415 |
users should not rely upon it. Assigning to YYVAL |
| 1416 |
unconditionally makes the parser a bit smaller, and it avoids a |
| 1417 |
GCC warning that YYVAL may be used uninitialized. */ |
| 1418 |
yyval = yyvsp[1-yylen]; |
| 1419 |
|
| 1420 |
|
| 1421 |
YY_REDUCE_PRINT (yyn); |
| 1422 |
switch (yyn) |
| 1423 |
{ |
| 1424 |
case 2: /* filter: expr */ |
| 1425 |
#line 76 "libsmartcols/src/filter-parser.y" |
| 1426 |
{ fltr->root = (yyvsp[0].param); } |
| 1427 |
#line 1428 "libsmartcols/src/filter-parser.c" |
| 1428 |
break; |
| 1429 |
|
| 1430 |
case 3: /* expr: param */ |
| 1431 |
#line 80 "libsmartcols/src/filter-parser.y" |
| 1432 |
{ (yyval.param) = (yyvsp[0].param); } |
| 1433 |
#line 1434 "libsmartcols/src/filter-parser.c" |
| 1434 |
break; |
| 1435 |
|
| 1436 |
case 4: /* expr: '(' expr ')' */ |
| 1437 |
#line 81 "libsmartcols/src/filter-parser.y" |
| 1438 |
{ (yyval.param) = (yyvsp[-1].param); } |
| 1439 |
#line 1440 "libsmartcols/src/filter-parser.c" |
| 1440 |
break; |
| 1441 |
|
| 1442 |
case 5: /* expr: expr T_AND expr */ |
| 1443 |
#line 82 "libsmartcols/src/filter-parser.y" |
| 1444 |
{ (yyval.param) = filter_new_expr(fltr, F_EXPR_AND, (yyvsp[-2].param), (yyvsp[0].param)); } |
| 1445 |
#line 1446 "libsmartcols/src/filter-parser.c" |
| 1446 |
break; |
| 1447 |
|
| 1448 |
case 6: /* expr: expr T_OR expr */ |
| 1449 |
#line 83 "libsmartcols/src/filter-parser.y" |
| 1450 |
{ (yyval.param) = filter_new_expr(fltr, F_EXPR_OR, (yyvsp[-2].param), (yyvsp[0].param)); } |
| 1451 |
#line 1452 "libsmartcols/src/filter-parser.c" |
| 1452 |
break; |
| 1453 |
|
| 1454 |
case 7: /* expr: T_NEG expr */ |
| 1455 |
#line 84 "libsmartcols/src/filter-parser.y" |
| 1456 |
{ (yyval.param) = filter_new_expr(fltr, F_EXPR_NEG, NULL, (yyvsp[0].param)); } |
| 1457 |
#line 1458 "libsmartcols/src/filter-parser.c" |
| 1458 |
break; |
| 1459 |
|
| 1460 |
case 8: /* expr: expr T_EQ expr */ |
| 1461 |
#line 85 "libsmartcols/src/filter-parser.y" |
| 1462 |
{ (yyval.param) = filter_new_expr(fltr, F_EXPR_EQ, (yyvsp[-2].param), (yyvsp[0].param)); } |
| 1463 |
#line 1464 "libsmartcols/src/filter-parser.c" |
| 1464 |
break; |
| 1465 |
|
| 1466 |
case 9: /* expr: expr T_NE expr */ |
| 1467 |
#line 86 "libsmartcols/src/filter-parser.y" |
| 1468 |
{ (yyval.param) = filter_new_expr(fltr, F_EXPR_NE, (yyvsp[-2].param), (yyvsp[0].param)); } |
| 1469 |
#line 1470 "libsmartcols/src/filter-parser.c" |
| 1470 |
break; |
| 1471 |
|
| 1472 |
case 10: /* expr: expr T_LE expr */ |
| 1473 |
#line 87 "libsmartcols/src/filter-parser.y" |
| 1474 |
{ (yyval.param) = filter_new_expr(fltr, F_EXPR_LE, (yyvsp[-2].param), (yyvsp[0].param)); } |
| 1475 |
#line 1476 "libsmartcols/src/filter-parser.c" |
| 1476 |
break; |
| 1477 |
|
| 1478 |
case 11: /* expr: expr T_LT expr */ |
| 1479 |
#line 88 "libsmartcols/src/filter-parser.y" |
| 1480 |
{ (yyval.param) = filter_new_expr(fltr, F_EXPR_LT, (yyvsp[-2].param), (yyvsp[0].param)); } |
| 1481 |
#line 1482 "libsmartcols/src/filter-parser.c" |
| 1482 |
break; |
| 1483 |
|
| 1484 |
case 12: /* expr: expr T_GE expr */ |
| 1485 |
#line 89 "libsmartcols/src/filter-parser.y" |
| 1486 |
{ (yyval.param) = filter_new_expr(fltr, F_EXPR_GE, (yyvsp[-2].param), (yyvsp[0].param)); } |
| 1487 |
#line 1488 "libsmartcols/src/filter-parser.c" |
| 1488 |
break; |
| 1489 |
|
| 1490 |
case 13: /* expr: expr T_GT expr */ |
| 1491 |
#line 90 "libsmartcols/src/filter-parser.y" |
| 1492 |
{ (yyval.param) = filter_new_expr(fltr, F_EXPR_GT, (yyvsp[-2].param), (yyvsp[0].param)); } |
| 1493 |
#line 1494 "libsmartcols/src/filter-parser.c" |
| 1494 |
break; |
| 1495 |
|
| 1496 |
case 14: /* expr: expr T_REG expr */ |
| 1497 |
#line 92 "libsmartcols/src/filter-parser.y" |
| 1498 |
{ |
| 1499 |
if (filter_compile_param(fltr, (struct filter_param *) (yyvsp[0].param)) != 0) |
| 1500 |
YYERROR; |
| 1501 |
(yyval.param) = filter_new_expr(fltr, F_EXPR_REG, (yyvsp[-2].param), (yyvsp[0].param)); |
| 1502 |
} |
| 1503 |
#line 1504 "libsmartcols/src/filter-parser.c" |
| 1504 |
break; |
| 1505 |
|
| 1506 |
case 15: /* expr: expr T_NREG expr */ |
| 1507 |
#line 98 "libsmartcols/src/filter-parser.y" |
| 1508 |
{ |
| 1509 |
if (filter_compile_param(fltr, (struct filter_param *) (yyvsp[0].param)) != 0) |
| 1510 |
YYERROR; |
| 1511 |
(yyval.param) = filter_new_expr(fltr, F_EXPR_NREG, (yyvsp[-2].param), (yyvsp[0].param)); |
| 1512 |
} |
| 1513 |
#line 1514 "libsmartcols/src/filter-parser.c" |
| 1514 |
break; |
| 1515 |
|
| 1516 |
case 16: /* param: T_NUMBER */ |
| 1517 |
#line 106 "libsmartcols/src/filter-parser.y" |
| 1518 |
{ (yyval.param) = filter_new_param(fltr, SCOLS_DATA_U64, 0, (void *) (&(yyvsp[0].param_number))); } |
| 1519 |
#line 1520 "libsmartcols/src/filter-parser.c" |
| 1520 |
break; |
| 1521 |
|
| 1522 |
case 17: /* param: T_FLOAT */ |
| 1523 |
#line 107 "libsmartcols/src/filter-parser.y" |
| 1524 |
{ (yyval.param) = filter_new_param(fltr, SCOLS_DATA_FLOAT, 0, (void *) (&(yyvsp[0].param_float))); } |
| 1525 |
#line 1526 "libsmartcols/src/filter-parser.c" |
| 1526 |
break; |
| 1527 |
|
| 1528 |
case 18: /* param: T_HOLDER */ |
| 1529 |
#line 108 "libsmartcols/src/filter-parser.y" |
| 1530 |
{ (yyval.param) = filter_new_param(fltr, SCOLS_DATA_NONE, F_HOLDER_COLUMN, (void *) (yyvsp[0].param_name)); } |
| 1531 |
#line 1532 "libsmartcols/src/filter-parser.c" |
| 1532 |
break; |
| 1533 |
|
| 1534 |
case 19: /* param: T_STRING */ |
| 1535 |
#line 109 "libsmartcols/src/filter-parser.y" |
| 1536 |
{ (yyval.param) = filter_new_param(fltr, SCOLS_DATA_STRING, 0, (void *) (yyvsp[0].param_string)); } |
| 1537 |
#line 1538 "libsmartcols/src/filter-parser.c" |
| 1538 |
break; |
| 1539 |
|
| 1540 |
case 20: /* param: T_TRUE */ |
| 1541 |
#line 110 "libsmartcols/src/filter-parser.y" |
| 1542 |
{ |
| 1543 |
bool x = true; |
| 1544 |
(yyval.param) = filter_new_param(fltr, SCOLS_DATA_BOOLEAN, 0, (void *) &x); |
| 1545 |
} |
| 1546 |
#line 1547 "libsmartcols/src/filter-parser.c" |
| 1547 |
break; |
| 1548 |
|
| 1549 |
case 21: /* param: T_FALSE */ |
| 1550 |
#line 114 "libsmartcols/src/filter-parser.y" |
| 1551 |
{ |
| 1552 |
bool x = false; |
| 1553 |
(yyval.param) = filter_new_param(fltr, SCOLS_DATA_BOOLEAN, 0, (void *) &x); |
| 1554 |
} |
| 1555 |
#line 1556 "libsmartcols/src/filter-parser.c" |
| 1556 |
break; |
| 1557 |
|
| 1558 |
case 22: /* param: T_INVALID_NUMBER */ |
| 1559 |
#line 118 "libsmartcols/src/filter-parser.y" |
| 1560 |
{ /* YYerror token is unsupported in old Bisons */ |
| 1561 |
ignore_result( (yyval.param) ); /* suppress "unset value" warning */ |
| 1562 |
YYERROR; /* yyerror() already called by lex() */ |
| 1563 |
} |
| 1564 |
#line 1565 "libsmartcols/src/filter-parser.c" |
| 1565 |
break; |
| 1566 |
|
| 1567 |
|
| 1568 |
#line 1569 "libsmartcols/src/filter-parser.c" |
| 1569 |
|
| 1570 |
default: break; |
| 1571 |
} |
| 1572 |
/* User semantic actions sometimes alter yychar, and that requires |
| 1573 |
that yytoken be updated with the new translation. We take the |
| 1574 |
approach of translating immediately before every use of yytoken. |
| 1575 |
One alternative is translating here after every semantic action, |
| 1576 |
but that translation would be missed if the semantic action invokes |
| 1577 |
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
| 1578 |
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
| 1579 |
incorrect destructor might then be invoked immediately. In the |
| 1580 |
case of YYERROR or YYBACKUP, subsequent parser actions might lead |
| 1581 |
to an incorrect destructor call or verbose syntax error message |
| 1582 |
before the lookahead is translated. */ |
| 1583 |
YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); |
| 1584 |
|
| 1585 |
YYPOPSTACK (yylen); |
| 1586 |
yylen = 0; |
| 1587 |
|
| 1588 |
*++yyvsp = yyval; |
| 1589 |
|
| 1590 |
/* Now 'shift' the result of the reduction. Determine what state |
| 1591 |
that goes to, based on the state we popped back to and the rule |
| 1592 |
number reduced by. */ |
| 1593 |
{ |
| 1594 |
const int yylhs = yyr1[yyn] - YYNTOKENS; |
| 1595 |
const int yyi = yypgoto[yylhs] + *yyssp; |
| 1596 |
yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp |
| 1597 |
? yytable[yyi] |
| 1598 |
: yydefgoto[yylhs]); |
| 1599 |
} |
| 1600 |
|
| 1601 |
goto yynewstate; |
| 1602 |
|
| 1603 |
|
| 1604 |
/*--------------------------------------. |
| 1605 |
| yyerrlab -- here on detecting error. | |
| 1606 |
`--------------------------------------*/ |
| 1607 |
yyerrlab: |
| 1608 |
/* Make sure we have latest lookahead translation. See comments at |
| 1609 |
user semantic actions for why this is necessary. */ |
| 1610 |
yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); |
| 1611 |
/* If not already recovering from an error, report this error. */ |
| 1612 |
if (!yyerrstatus) |
| 1613 |
{ |
| 1614 |
++yynerrs; |
| 1615 |
{ |
| 1616 |
yypcontext_t yyctx |
| 1617 |
= {yyssp, yytoken}; |
| 1618 |
char const *yymsgp = YY_("syntax error"); |
| 1619 |
int yysyntax_error_status; |
| 1620 |
yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); |
| 1621 |
if (yysyntax_error_status == 0) |
| 1622 |
yymsgp = yymsg; |
| 1623 |
else if (yysyntax_error_status == -1) |
| 1624 |
{ |
| 1625 |
if (yymsg != yymsgbuf) |
| 1626 |
YYSTACK_FREE (yymsg); |
| 1627 |
yymsg = YY_CAST (char *, |
| 1628 |
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); |
| 1629 |
if (yymsg) |
| 1630 |
{ |
| 1631 |
yysyntax_error_status |
| 1632 |
= yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); |
| 1633 |
yymsgp = yymsg; |
| 1634 |
} |
| 1635 |
else |
| 1636 |
{ |
| 1637 |
yymsg = yymsgbuf; |
| 1638 |
yymsg_alloc = sizeof yymsgbuf; |
| 1639 |
yysyntax_error_status = YYENOMEM; |
| 1640 |
} |
| 1641 |
} |
| 1642 |
yyerror (scanner, fltr, yymsgp); |
| 1643 |
if (yysyntax_error_status == YYENOMEM) |
| 1644 |
YYNOMEM; |
| 1645 |
} |
| 1646 |
} |
| 1647 |
|
| 1648 |
if (yyerrstatus == 3) |
| 1649 |
{ |
| 1650 |
/* If just tried and failed to reuse lookahead token after an |
| 1651 |
error, discard it. */ |
| 1652 |
|
| 1653 |
if (yychar <= YYEOF) |
| 1654 |
{ |
| 1655 |
/* Return failure if at end of input. */ |
| 1656 |
if (yychar == YYEOF) |
| 1657 |
YYABORT; |
| 1658 |
} |
| 1659 |
else |
| 1660 |
{ |
| 1661 |
yydestruct ("Error: discarding", |
| 1662 |
yytoken, &yylval, scanner, fltr); |
| 1663 |
yychar = YYEMPTY; |
| 1664 |
} |
| 1665 |
} |
| 1666 |
|
| 1667 |
/* Else will try to reuse lookahead token after shifting the error |
| 1668 |
token. */ |
| 1669 |
goto yyerrlab1; |
| 1670 |
|
| 1671 |
|
| 1672 |
/*---------------------------------------------------. |
| 1673 |
| yyerrorlab -- error raised explicitly by YYERROR. | |
| 1674 |
`---------------------------------------------------*/ |
| 1675 |
yyerrorlab: |
| 1676 |
/* Pacify compilers when the user code never invokes YYERROR and the |
| 1677 |
label yyerrorlab therefore never appears in user code. */ |
| 1678 |
if (0) |
| 1679 |
YYERROR; |
| 1680 |
++yynerrs; |
| 1681 |
|
| 1682 |
/* Do not reclaim the symbols of the rule whose action triggered |
| 1683 |
this YYERROR. */ |
| 1684 |
YYPOPSTACK (yylen); |
| 1685 |
yylen = 0; |
| 1686 |
YY_STACK_PRINT (yyss, yyssp); |
| 1687 |
yystate = *yyssp; |
| 1688 |
goto yyerrlab1; |
| 1689 |
|
| 1690 |
|
| 1691 |
/*-------------------------------------------------------------. |
| 1692 |
| yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 1693 |
`-------------------------------------------------------------*/ |
| 1694 |
yyerrlab1: |
| 1695 |
yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 1696 |
|
| 1697 |
/* Pop stack until we find a state that shifts the error token. */ |
| 1698 |
for (;;) |
| 1699 |
{ |
| 1700 |
yyn = yypact[yystate]; |
| 1701 |
if (!yypact_value_is_default (yyn)) |
| 1702 |
{ |
| 1703 |
yyn += YYSYMBOL_YYerror; |
| 1704 |
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) |
| 1705 |
{ |
| 1706 |
yyn = yytable[yyn]; |
| 1707 |
if (0 < yyn) |
| 1708 |
break; |
| 1709 |
} |
| 1710 |
} |
| 1711 |
|
| 1712 |
/* Pop the current state because it cannot handle the error token. */ |
| 1713 |
if (yyssp == yyss) |
| 1714 |
YYABORT; |
| 1715 |
|
| 1716 |
|
| 1717 |
yydestruct ("Error: popping", |
| 1718 |
YY_ACCESSING_SYMBOL (yystate), yyvsp, scanner, fltr); |
| 1719 |
YYPOPSTACK (1); |
| 1720 |
yystate = *yyssp; |
| 1721 |
YY_STACK_PRINT (yyss, yyssp); |
| 1722 |
} |
| 1723 |
|
| 1724 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1725 |
*++yyvsp = yylval; |
| 1726 |
YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1727 |
|
| 1728 |
|
| 1729 |
/* Shift the error token. */ |
| 1730 |
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); |
| 1731 |
|
| 1732 |
yystate = yyn; |
| 1733 |
goto yynewstate; |
| 1734 |
|
| 1735 |
|
| 1736 |
/*-------------------------------------. |
| 1737 |
| yyacceptlab -- YYACCEPT comes here. | |
| 1738 |
`-------------------------------------*/ |
| 1739 |
yyacceptlab: |
| 1740 |
yyresult = 0; |
| 1741 |
goto yyreturnlab; |
| 1742 |
|
| 1743 |
|
| 1744 |
/*-----------------------------------. |
| 1745 |
| yyabortlab -- YYABORT comes here. | |
| 1746 |
`-----------------------------------*/ |
| 1747 |
yyabortlab: |
| 1748 |
yyresult = 1; |
| 1749 |
goto yyreturnlab; |
| 1750 |
|
| 1751 |
|
| 1752 |
/*-----------------------------------------------------------. |
| 1753 |
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | |
| 1754 |
`-----------------------------------------------------------*/ |
| 1755 |
yyexhaustedlab: |
| 1756 |
yyerror (scanner, fltr, YY_("memory exhausted")); |
| 1757 |
yyresult = 2; |
| 1758 |
goto yyreturnlab; |
| 1759 |
|
| 1760 |
|
| 1761 |
/*----------------------------------------------------------. |
| 1762 |
| yyreturnlab -- parsing is finished, clean up and return. | |
| 1763 |
`----------------------------------------------------------*/ |
| 1764 |
yyreturnlab: |
| 1765 |
if (yychar != YYEMPTY) |
| 1766 |
{ |
| 1767 |
/* Make sure we have latest lookahead translation. See comments at |
| 1768 |
user semantic actions for why this is necessary. */ |
| 1769 |
yytoken = YYTRANSLATE (yychar); |
| 1770 |
yydestruct ("Cleanup: discarding lookahead", |
| 1771 |
yytoken, &yylval, scanner, fltr); |
| 1772 |
} |
| 1773 |
/* Do not reclaim the symbols of the rule whose action triggered |
| 1774 |
this YYABORT or YYACCEPT. */ |
| 1775 |
YYPOPSTACK (yylen); |
| 1776 |
YY_STACK_PRINT (yyss, yyssp); |
| 1777 |
while (yyssp != yyss) |
| 1778 |
{ |
| 1779 |
yydestruct ("Cleanup: popping", |
| 1780 |
YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, scanner, fltr); |
| 1781 |
YYPOPSTACK (1); |
| 1782 |
} |
| 1783 |
#ifndef yyoverflow |
| 1784 |
if (yyss != yyssa) |
| 1785 |
YYSTACK_FREE (yyss); |
| 1786 |
#endif |
| 1787 |
if (yymsg != yymsgbuf) |
| 1788 |
YYSTACK_FREE (yymsg); |
| 1789 |
return yyresult; |
| 1790 |
} |
| 1791 |
|
| 1792 |
#line 125 "libsmartcols/src/filter-parser.y" |
| 1793 |
|
| 1794 |
|
| 1795 |
void yyerror (yyscan_t *locp __attribute__((__unused__)), |
| 1796 |
struct libscols_filter *fltr, |
| 1797 |
char const *fmt, ...) |
| 1798 |
{ |
| 1799 |
if (fmt && fltr) { |
| 1800 |
char *p; |
| 1801 |
va_list ap; |
| 1802 |
int e; |
| 1803 |
|
| 1804 |
if (fltr->errmsg) { |
| 1805 |
free(fltr->errmsg); |
| 1806 |
fltr->errmsg = NULL; |
| 1807 |
} |
| 1808 |
|
| 1809 |
va_start(ap, fmt); |
| 1810 |
e = vasprintf(&fltr->errmsg, fmt, ap); |
| 1811 |
va_end(ap); |
| 1812 |
|
| 1813 |
if (e < 0 || !fltr->errmsg) |
| 1814 |
return; |
| 1815 |
|
| 1816 |
p = strstr(fltr->errmsg, "T_"); |
| 1817 |
if (p) { |
| 1818 |
size_t sz = strlen(fltr->errmsg); |
| 1819 |
memmove(p, p + 2, sz - 1 - (p - fltr->errmsg)); |
| 1820 |
} |
| 1821 |
} |
| 1822 |
errno = EINVAL; |
| 1823 |
} |