#include <stdint.h>
#include <libmemcached/common.h>
+#include <libmemcached/options.hpp>
+
#include <libmemcached/options/context.h>
#include <libmemcached/options/symbol.h>
#include <libmemcached/options/scanner.h>
/* Line 189 of yacc.c */
-#line 106 "libmemcached/options/parser.cc"
+#line 108 "libmemcached/options/parser.cc"
/* Enabling traces. */
#ifndef YYDEBUG
/* Line 264 of yacc.c */
-#line 217 "libmemcached/options/parser.cc"
+#line 219 "libmemcached/options/parser.cc"
#ifdef short
# undef short
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 155, 155, 156, 160, 162, 164, 166, 171, 176,
- 180, 184, 195, 203, 211, 215, 219, 223, 227, 234,
- 241, 252, 259, 266, 273, 279, 283, 287, 291, 295,
- 299, 303, 307, 311, 315, 319, 323, 330, 334, 338,
- 342, 346, 350, 354, 358, 362, 366, 370, 374, 381,
- 382, 387, 388, 393, 397, 401, 405, 409, 413, 417,
- 421, 425, 432, 436, 444, 448, 452
+ 0, 159, 159, 160, 164, 166, 168, 170, 175, 180,
+ 184, 188, 199, 207, 215, 219, 223, 227, 231, 238,
+ 245, 256, 263, 270, 277, 283, 287, 291, 295, 299,
+ 303, 307, 311, 315, 319, 323, 327, 334, 338, 342,
+ 346, 350, 354, 358, 362, 366, 370, 374, 378, 385,
+ 386, 391, 392, 397, 401, 405, 409, 413, 417, 421,
+ 425, 429, 436, 440, 448, 452, 456
};
#endif
case 4:
/* Line 1464 of yacc.c */
-#line 161 "libmemcached/options/parser.yy"
+#line 165 "libmemcached/options/parser.yy"
{ ;}
break;
case 5:
/* Line 1464 of yacc.c */
-#line 163 "libmemcached/options/parser.yy"
+#line 167 "libmemcached/options/parser.yy"
{ ;}
break;
case 6:
/* Line 1464 of yacc.c */
-#line 165 "libmemcached/options/parser.yy"
+#line 169 "libmemcached/options/parser.yy"
{ ;}
break;
case 7:
/* Line 1464 of yacc.c */
-#line 167 "libmemcached/options/parser.yy"
+#line 171 "libmemcached/options/parser.yy"
{
context->set_end();
YYACCEPT;
case 8:
/* Line 1464 of yacc.c */
-#line 172 "libmemcached/options/parser.yy"
+#line 176 "libmemcached/options/parser.yy"
{
context->rc= MEMCACHED_PARSE_USER_ERROR;
parser_abort(context, NULL);
case 9:
/* Line 1464 of yacc.c */
-#line 177 "libmemcached/options/parser.yy"
+#line 181 "libmemcached/options/parser.yy"
{
memcached_reset(context->memc);
;}
case 10:
/* Line 1464 of yacc.c */
-#line 181 "libmemcached/options/parser.yy"
+#line 185 "libmemcached/options/parser.yy"
{
yydebug= 1;
;}
case 11:
/* Line 1464 of yacc.c */
-#line 185 "libmemcached/options/parser.yy"
+#line 189 "libmemcached/options/parser.yy"
{
- if ((context->rc= memcached_parse_configure_file(context->memc, (yyvsp[(3) - (3)].string).c_str, (yyvsp[(3) - (3)].string).size)) != MEMCACHED_SUCCESS)
+ if ((context->rc= memcached_parse_configure_file(*context->memc, (yyvsp[(3) - (3)].string).c_str, (yyvsp[(3) - (3)].string).size)) != MEMCACHED_SUCCESS)
{
parser_abort(context, NULL);
}
case 12:
/* Line 1464 of yacc.c */
-#line 196 "libmemcached/options/parser.yy"
+#line 200 "libmemcached/options/parser.yy"
{
- if ((context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(2) - (4)].server).port, (yyvsp[(2) - (4)].server).weight)) != MEMCACHED_SUCCESS)
+ if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(3) - (4)].number), (yyvsp[(4) - (4)].number))))
{
parser_abort(context, NULL);
}
case 13:
/* Line 1464 of yacc.c */
-#line 204 "libmemcached/options/parser.yy"
+#line 208 "libmemcached/options/parser.yy"
{
- if ((context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(2) - (4)].server).port, (yyvsp[(2) - (4)].server).weight)) != MEMCACHED_SUCCESS)
+ if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(3) - (4)].number), (yyvsp[(4) - (4)].number))))
{
parser_abort(context, NULL);
}
case 14:
/* Line 1464 of yacc.c */
-#line 212 "libmemcached/options/parser.yy"
+#line 216 "libmemcached/options/parser.yy"
{
memcached_set_configuration_file(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).size);
;}
case 15:
/* Line 1464 of yacc.c */
-#line 216 "libmemcached/options/parser.yy"
+#line 220 "libmemcached/options/parser.yy"
{
context->memc->configure.initial_pool_size= (yyvsp[(2) - (2)].number);
;}
case 16:
/* Line 1464 of yacc.c */
-#line 220 "libmemcached/options/parser.yy"
+#line 224 "libmemcached/options/parser.yy"
{
context->memc->configure.max_pool_size= (yyvsp[(2) - (2)].number);
;}
case 18:
/* Line 1464 of yacc.c */
-#line 228 "libmemcached/options/parser.yy"
+#line 232 "libmemcached/options/parser.yy"
{
if ((context->rc= memcached_set_prefix_key(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).size)) != MEMCACHED_SUCCESS)
{
case 19:
/* Line 1464 of yacc.c */
-#line 235 "libmemcached/options/parser.yy"
+#line 239 "libmemcached/options/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (2)].distribution))) != MEMCACHED_SUCCESS)
{
case 20:
/* Line 1464 of yacc.c */
-#line 242 "libmemcached/options/parser.yy"
+#line 246 "libmemcached/options/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (4)].distribution))) != MEMCACHED_SUCCESS)
{
case 21:
/* Line 1464 of yacc.c */
-#line 253 "libmemcached/options/parser.yy"
+#line 257 "libmemcached/options/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_HASH, (yyvsp[(2) - (2)].hash))) != MEMCACHED_SUCCESS)
{
case 22:
/* Line 1464 of yacc.c */
-#line 260 "libmemcached/options/parser.yy"
+#line 264 "libmemcached/options/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, (yyvsp[(1) - (2)].behavior), (yyvsp[(2) - (2)].number))) != MEMCACHED_SUCCESS)
{
case 23:
/* Line 1464 of yacc.c */
-#line 267 "libmemcached/options/parser.yy"
+#line 271 "libmemcached/options/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, (yyvsp[(1) - (1)].behavior), true)) != MEMCACHED_SUCCESS)
{
case 24:
/* Line 1464 of yacc.c */
-#line 274 "libmemcached/options/parser.yy"
+#line 278 "libmemcached/options/parser.yy"
{
;}
break;
case 25:
/* Line 1464 of yacc.c */
-#line 280 "libmemcached/options/parser.yy"
+#line 284 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS;
;}
case 26:
/* Line 1464 of yacc.c */
-#line 284 "libmemcached/options/parser.yy"
+#line 288 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT;
;}
case 27:
/* Line 1464 of yacc.c */
-#line 288 "libmemcached/options/parser.yy"
+#line 292 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK;
;}
case 28:
/* Line 1464 of yacc.c */
-#line 292 "libmemcached/options/parser.yy"
+#line 296 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK;
;}
case 29:
/* Line 1464 of yacc.c */
-#line 296 "libmemcached/options/parser.yy"
+#line 300 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH;
;}
case 30:
/* Line 1464 of yacc.c */
-#line 300 "libmemcached/options/parser.yy"
+#line 304 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS;
;}
case 31:
/* Line 1464 of yacc.c */
-#line 304 "libmemcached/options/parser.yy"
+#line 308 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_POLL_TIMEOUT;
;}
case 32:
/* Line 1464 of yacc.c */
-#line 308 "libmemcached/options/parser.yy"
+#line 312 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_RCV_TIMEOUT;
;}
case 33:
/* Line 1464 of yacc.c */
-#line 312 "libmemcached/options/parser.yy"
+#line 316 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_RETRY_TIMEOUT;
;}
case 34:
/* Line 1464 of yacc.c */
-#line 316 "libmemcached/options/parser.yy"
+#line 320 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SND_TIMEOUT;
;}
case 35:
/* Line 1464 of yacc.c */
-#line 320 "libmemcached/options/parser.yy"
+#line 324 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE;
;}
case 36:
/* Line 1464 of yacc.c */
-#line 324 "libmemcached/options/parser.yy"
+#line 328 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE;
;}
case 37:
/* Line 1464 of yacc.c */
-#line 331 "libmemcached/options/parser.yy"
+#line 335 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_BINARY_PROTOCOL;
;}
case 38:
/* Line 1464 of yacc.c */
-#line 335 "libmemcached/options/parser.yy"
+#line 339 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_BUFFER_REQUESTS;
;}
case 39:
/* Line 1464 of yacc.c */
-#line 339 "libmemcached/options/parser.yy"
+#line 343 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY;
;}
case 40:
/* Line 1464 of yacc.c */
-#line 343 "libmemcached/options/parser.yy"
+#line 347 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_NOREPLY;
;}
case 41:
/* Line 1464 of yacc.c */
-#line 347 "libmemcached/options/parser.yy"
+#line 351 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ;
;}
case 42:
/* Line 1464 of yacc.c */
-#line 351 "libmemcached/options/parser.yy"
+#line 355 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SORT_HOSTS;
;}
case 43:
/* Line 1464 of yacc.c */
-#line 355 "libmemcached/options/parser.yy"
+#line 359 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SUPPORT_CAS;
;}
case 44:
/* Line 1464 of yacc.c */
-#line 359 "libmemcached/options/parser.yy"
+#line 363 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_NODELAY;
;}
case 45:
/* Line 1464 of yacc.c */
-#line 363 "libmemcached/options/parser.yy"
+#line 367 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_KEEPALIVE;
;}
case 46:
/* Line 1464 of yacc.c */
-#line 367 "libmemcached/options/parser.yy"
+#line 371 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_KEEPIDLE;
;}
case 47:
/* Line 1464 of yacc.c */
-#line 371 "libmemcached/options/parser.yy"
+#line 375 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_USE_UDP;
;}
case 48:
/* Line 1464 of yacc.c */
-#line 375 "libmemcached/options/parser.yy"
+#line 379 "libmemcached/options/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_VERIFY_KEY;
;}
case 49:
/* Line 1464 of yacc.c */
-#line 381 "libmemcached/options/parser.yy"
- { ;}
+#line 385 "libmemcached/options/parser.yy"
+ { (yyval.number)= MEMCACHED_DEFAULT_PORT;;}
break;
case 50:
/* Line 1464 of yacc.c */
-#line 383 "libmemcached/options/parser.yy"
+#line 387 "libmemcached/options/parser.yy"
{ ;}
break;
case 51:
/* Line 1464 of yacc.c */
-#line 387 "libmemcached/options/parser.yy"
- { ;}
+#line 391 "libmemcached/options/parser.yy"
+ { (yyval.number)= 1; ;}
break;
case 52:
/* Line 1464 of yacc.c */
-#line 389 "libmemcached/options/parser.yy"
+#line 393 "libmemcached/options/parser.yy"
{ ;}
break;
case 53:
/* Line 1464 of yacc.c */
-#line 394 "libmemcached/options/parser.yy"
+#line 398 "libmemcached/options/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_MD5;
;}
case 54:
/* Line 1464 of yacc.c */
-#line 398 "libmemcached/options/parser.yy"
+#line 402 "libmemcached/options/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_CRC;
;}
case 55:
/* Line 1464 of yacc.c */
-#line 402 "libmemcached/options/parser.yy"
+#line 406 "libmemcached/options/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1_64;
;}
case 56:
/* Line 1464 of yacc.c */
-#line 406 "libmemcached/options/parser.yy"
+#line 410 "libmemcached/options/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1A_64;
;}
case 57:
/* Line 1464 of yacc.c */
-#line 410 "libmemcached/options/parser.yy"
+#line 414 "libmemcached/options/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1_32;
;}
case 58:
/* Line 1464 of yacc.c */
-#line 414 "libmemcached/options/parser.yy"
+#line 418 "libmemcached/options/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1A_32;
;}
case 59:
/* Line 1464 of yacc.c */
-#line 418 "libmemcached/options/parser.yy"
+#line 422 "libmemcached/options/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_HSIEH;
;}
case 60:
/* Line 1464 of yacc.c */
-#line 422 "libmemcached/options/parser.yy"
+#line 426 "libmemcached/options/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_MURMUR;
;}
case 61:
/* Line 1464 of yacc.c */
-#line 426 "libmemcached/options/parser.yy"
+#line 430 "libmemcached/options/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_JENKINS;
;}
case 62:
/* Line 1464 of yacc.c */
-#line 433 "libmemcached/options/parser.yy"
+#line 437 "libmemcached/options/parser.yy"
{
(yyval.string)= (yyvsp[(1) - (1)].string);
;}
case 63:
/* Line 1464 of yacc.c */
-#line 437 "libmemcached/options/parser.yy"
+#line 441 "libmemcached/options/parser.yy"
{
(yyval.string).c_str= (yyvsp[(1) - (1)].string).c_str +1; // +1 to move use passed the initial quote
(yyval.string).size= (yyvsp[(1) - (1)].string).size -2; // -2 removes the begin and end quote
case 64:
/* Line 1464 of yacc.c */
-#line 445 "libmemcached/options/parser.yy"
+#line 449 "libmemcached/options/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_CONSISTENT;
;}
case 65:
/* Line 1464 of yacc.c */
-#line 449 "libmemcached/options/parser.yy"
+#line 453 "libmemcached/options/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_MODULA;
;}
case 66:
/* Line 1464 of yacc.c */
-#line 453 "libmemcached/options/parser.yy"
+#line 457 "libmemcached/options/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_RANDOM;
;}
/* Line 1464 of yacc.c */
-#line 2103 "libmemcached/options/parser.cc"
+#line 2105 "libmemcached/options/parser.cc"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
/* Line 1684 of yacc.c */
-#line 458 "libmemcached/options/parser.yy"
+#line 462 "libmemcached/options/parser.yy"
void Context::start()