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