/* Copy the first part of user declarations. */
/* Line 268 of yacc.c */
-#line 36 "libmemcached/csl/parser.yy"
+#line 52 "libmemcached/csl/parser.yy"
#include <libmemcached/csl/common.h>
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 172, 172, 173, 177, 179, 181, 183, 188, 193,
- 197, 201, 212, 220, 228, 235, 239, 243, 247, 251,
- 263, 270, 281, 288, 295, 302, 308, 312, 316, 320,
- 324, 328, 332, 336, 340, 344, 348, 352, 359, 363,
- 367, 371, 375, 379, 383, 387, 391, 395, 399, 403,
- 410, 411, 416, 417, 422, 426, 430, 434, 438, 442,
- 446, 450, 454, 461, 465, 472, 476, 480
+ 0, 188, 188, 189, 193, 195, 197, 199, 204, 209,
+ 213, 217, 228, 238, 248, 257, 261, 265, 269, 273,
+ 285, 298, 311, 318, 325, 334, 340, 344, 348, 352,
+ 356, 360, 364, 368, 372, 376, 380, 384, 391, 395,
+ 399, 403, 407, 411, 415, 419, 423, 427, 431, 435,
+ 442, 443, 448, 449, 454, 458, 462, 466, 470, 474,
+ 478, 482, 486, 493, 497, 504, 508, 512
};
#endif
case 4:
/* Line 1806 of yacc.c */
-#line 178 "libmemcached/csl/parser.yy"
+#line 194 "libmemcached/csl/parser.yy"
{ }
break;
case 5:
/* Line 1806 of yacc.c */
-#line 180 "libmemcached/csl/parser.yy"
+#line 196 "libmemcached/csl/parser.yy"
{ }
break;
case 6:
/* Line 1806 of yacc.c */
-#line 182 "libmemcached/csl/parser.yy"
+#line 198 "libmemcached/csl/parser.yy"
{ }
break;
case 7:
/* Line 1806 of yacc.c */
-#line 184 "libmemcached/csl/parser.yy"
+#line 200 "libmemcached/csl/parser.yy"
{
context->set_end();
YYACCEPT;
case 8:
/* Line 1806 of yacc.c */
-#line 189 "libmemcached/csl/parser.yy"
+#line 205 "libmemcached/csl/parser.yy"
{
context->rc= MEMCACHED_PARSE_USER_ERROR;
- parser_abort(context, NULL);
+ parser_abort(context, "ERROR called directly");
}
break;
case 9:
/* Line 1806 of yacc.c */
-#line 194 "libmemcached/csl/parser.yy"
+#line 210 "libmemcached/csl/parser.yy"
{
memcached_reset(context->memc);
}
case 10:
/* Line 1806 of yacc.c */
-#line 198 "libmemcached/csl/parser.yy"
+#line 214 "libmemcached/csl/parser.yy"
{
yydebug= 1;
}
case 11:
/* Line 1806 of yacc.c */
-#line 202 "libmemcached/csl/parser.yy"
+#line 218 "libmemcached/csl/parser.yy"
{
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);
+ parser_abort(context, "Failed to parse configuration file");
}
}
break;
case 12:
/* Line 1806 of yacc.c */
-#line 213 "libmemcached/csl/parser.yy"
+#line 229 "libmemcached/csl/parser.yy"
{
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);
+ char buffer[1024];
+ snprintf(buffer, sizeof(buffer), "Failed to add server: %s:%u", (yyvsp[(2) - (4)].server).c_str, uint32_t((yyvsp[(3) - (4)].number)));
+ parser_abort(context, buffer);
}
context->unset_server();
}
case 13:
/* Line 1806 of yacc.c */
-#line 221 "libmemcached/csl/parser.yy"
+#line 239 "libmemcached/csl/parser.yy"
{
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);
+ char buffer[1024];
+ snprintf(buffer, sizeof(buffer), "Failed to add server: %s:%u", (yyvsp[(2) - (4)].server).c_str, uint32_t((yyvsp[(3) - (4)].number)));
+ parser_abort(context, buffer);
}
context->unset_server();
}
case 14:
/* Line 1806 of yacc.c */
-#line 229 "libmemcached/csl/parser.yy"
+#line 249 "libmemcached/csl/parser.yy"
{
if (memcached_failed(context->rc= memcached_server_add_unix_socket_with_weight(context->memc, (yyvsp[(2) - (3)].string).c_str, (yyvsp[(3) - (3)].number))))
{
- parser_abort(context, NULL);
+ char buffer[1024];
+ snprintf(buffer, sizeof(buffer), "Failed to add server: %s", (yyvsp[(2) - (3)].string).c_str);
+ parser_abort(context, buffer);
}
}
break;
case 15:
/* Line 1806 of yacc.c */
-#line 236 "libmemcached/csl/parser.yy"
+#line 258 "libmemcached/csl/parser.yy"
{
memcached_set_configuration_file(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).size);
}
case 16:
/* Line 1806 of yacc.c */
-#line 240 "libmemcached/csl/parser.yy"
+#line 262 "libmemcached/csl/parser.yy"
{
context->memc->configure.initial_pool_size= (yyvsp[(2) - (2)].number);
}
case 17:
/* Line 1806 of yacc.c */
-#line 244 "libmemcached/csl/parser.yy"
+#line 266 "libmemcached/csl/parser.yy"
{
context->memc->configure.max_pool_size= (yyvsp[(2) - (2)].number);
}
case 19:
/* Line 1806 of yacc.c */
-#line 252 "libmemcached/csl/parser.yy"
+#line 274 "libmemcached/csl/parser.yy"
{
if (memcached_callback_get(context->memc, MEMCACHED_CALLBACK_PREFIX_KEY, NULL))
{
case 20:
/* Line 1806 of yacc.c */
-#line 264 "libmemcached/csl/parser.yy"
+#line 286 "libmemcached/csl/parser.yy"
{
+ // Check to see if DISTRIBUTION has already been set
+ if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (2)].distribution))) != MEMCACHED_SUCCESS)
+ {
+ parser_abort(context, "--DISTRIBUTION can only be called once");
+ }
+
if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (2)].distribution))) != MEMCACHED_SUCCESS)
{
parser_abort(context, memcached_last_error_message(context->memc));;
case 21:
/* Line 1806 of yacc.c */
-#line 271 "libmemcached/csl/parser.yy"
+#line 299 "libmemcached/csl/parser.yy"
{
+ // Check to see if DISTRIBUTION has already been set
if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (4)].distribution))) != MEMCACHED_SUCCESS)
{
- parser_abort(context, NULL);
+ parser_abort(context, "--DISTRIBUTION can only be called once");
}
+
if ((context->rc= memcached_behavior_set_distribution_hash(context->memc, (yyvsp[(4) - (4)].hash))) != MEMCACHED_SUCCESS)
{
- parser_abort(context, NULL);
+ parser_abort(context, "Unable to set the hash for the DISTRIBUTION requested");
}
}
break;
case 22:
/* Line 1806 of yacc.c */
-#line 282 "libmemcached/csl/parser.yy"
+#line 312 "libmemcached/csl/parser.yy"
{
- if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_HASH, (yyvsp[(2) - (2)].hash))) != MEMCACHED_SUCCESS)
+ if (context->set_hash((yyvsp[(2) - (2)].hash)) == false)
{
- parser_abort(context, NULL);
+ parser_abort(context, "--HASH can only be set once");
}
}
break;
case 23:
/* Line 1806 of yacc.c */
-#line 289 "libmemcached/csl/parser.yy"
+#line 319 "libmemcached/csl/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, (yyvsp[(1) - (2)].behavior), (yyvsp[(2) - (2)].number))) != MEMCACHED_SUCCESS)
{
- parser_abort(context, NULL);
+ parser_abort(context, "Unable to set behavior");
}
}
break;
case 24:
/* Line 1806 of yacc.c */
-#line 296 "libmemcached/csl/parser.yy"
+#line 326 "libmemcached/csl/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, (yyvsp[(1) - (1)].behavior), true)) != MEMCACHED_SUCCESS)
{
- parser_abort(context, NULL);
+ char buffer[1024];
+ snprintf(buffer, sizeof(buffer), "Could not set: %s", libmemcached_string_behavior((yyvsp[(1) - (1)].behavior)));
+ parser_abort(context, buffer);
}
}
break;
case 25:
/* Line 1806 of yacc.c */
-#line 303 "libmemcached/csl/parser.yy"
+#line 335 "libmemcached/csl/parser.yy"
{
}
break;
case 26:
/* Line 1806 of yacc.c */
-#line 309 "libmemcached/csl/parser.yy"
+#line 341 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS;
}
case 27:
/* Line 1806 of yacc.c */
-#line 313 "libmemcached/csl/parser.yy"
+#line 345 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT;
}
case 28:
/* Line 1806 of yacc.c */
-#line 317 "libmemcached/csl/parser.yy"
+#line 349 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK;
}
case 29:
/* Line 1806 of yacc.c */
-#line 321 "libmemcached/csl/parser.yy"
+#line 353 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK;
}
case 30:
/* Line 1806 of yacc.c */
-#line 325 "libmemcached/csl/parser.yy"
+#line 357 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH;
}
case 31:
/* Line 1806 of yacc.c */
-#line 329 "libmemcached/csl/parser.yy"
+#line 361 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS;
}
case 32:
/* Line 1806 of yacc.c */
-#line 333 "libmemcached/csl/parser.yy"
+#line 365 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_POLL_TIMEOUT;
}
case 33:
/* Line 1806 of yacc.c */
-#line 337 "libmemcached/csl/parser.yy"
+#line 369 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_RCV_TIMEOUT;
}
case 34:
/* Line 1806 of yacc.c */
-#line 341 "libmemcached/csl/parser.yy"
+#line 373 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_RETRY_TIMEOUT;
}
case 35:
/* Line 1806 of yacc.c */
-#line 345 "libmemcached/csl/parser.yy"
+#line 377 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SND_TIMEOUT;
}
case 36:
/* Line 1806 of yacc.c */
-#line 349 "libmemcached/csl/parser.yy"
+#line 381 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE;
}
case 37:
/* Line 1806 of yacc.c */
-#line 353 "libmemcached/csl/parser.yy"
+#line 385 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE;
}
case 38:
/* Line 1806 of yacc.c */
-#line 360 "libmemcached/csl/parser.yy"
+#line 392 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_BINARY_PROTOCOL;
}
case 39:
/* Line 1806 of yacc.c */
-#line 364 "libmemcached/csl/parser.yy"
+#line 396 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_BUFFER_REQUESTS;
}
case 40:
/* Line 1806 of yacc.c */
-#line 368 "libmemcached/csl/parser.yy"
+#line 400 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY;
}
case 41:
/* Line 1806 of yacc.c */
-#line 372 "libmemcached/csl/parser.yy"
+#line 404 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_NOREPLY;
}
case 42:
/* Line 1806 of yacc.c */
-#line 376 "libmemcached/csl/parser.yy"
+#line 408 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ;
}
case 43:
/* Line 1806 of yacc.c */
-#line 380 "libmemcached/csl/parser.yy"
+#line 412 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SORT_HOSTS;
}
case 44:
/* Line 1806 of yacc.c */
-#line 384 "libmemcached/csl/parser.yy"
+#line 416 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SUPPORT_CAS;
}
case 45:
/* Line 1806 of yacc.c */
-#line 388 "libmemcached/csl/parser.yy"
+#line 420 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_NODELAY;
}
case 46:
/* Line 1806 of yacc.c */
-#line 392 "libmemcached/csl/parser.yy"
+#line 424 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_KEEPALIVE;
}
case 47:
/* Line 1806 of yacc.c */
-#line 396 "libmemcached/csl/parser.yy"
+#line 428 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_KEEPIDLE;
}
case 48:
/* Line 1806 of yacc.c */
-#line 400 "libmemcached/csl/parser.yy"
+#line 432 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_USE_UDP;
}
case 49:
/* Line 1806 of yacc.c */
-#line 404 "libmemcached/csl/parser.yy"
+#line 436 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_VERIFY_KEY;
}
case 50:
/* Line 1806 of yacc.c */
-#line 410 "libmemcached/csl/parser.yy"
+#line 442 "libmemcached/csl/parser.yy"
{ (yyval.number)= MEMCACHED_DEFAULT_PORT;}
break;
case 51:
/* Line 1806 of yacc.c */
-#line 412 "libmemcached/csl/parser.yy"
+#line 444 "libmemcached/csl/parser.yy"
{ }
break;
case 52:
/* Line 1806 of yacc.c */
-#line 416 "libmemcached/csl/parser.yy"
+#line 448 "libmemcached/csl/parser.yy"
{ (yyval.number)= 1; }
break;
case 53:
/* Line 1806 of yacc.c */
-#line 418 "libmemcached/csl/parser.yy"
+#line 450 "libmemcached/csl/parser.yy"
{ }
break;
case 54:
/* Line 1806 of yacc.c */
-#line 423 "libmemcached/csl/parser.yy"
+#line 455 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_MD5;
}
case 55:
/* Line 1806 of yacc.c */
-#line 427 "libmemcached/csl/parser.yy"
+#line 459 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_CRC;
}
case 56:
/* Line 1806 of yacc.c */
-#line 431 "libmemcached/csl/parser.yy"
+#line 463 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1_64;
}
case 57:
/* Line 1806 of yacc.c */
-#line 435 "libmemcached/csl/parser.yy"
+#line 467 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1A_64;
}
case 58:
/* Line 1806 of yacc.c */
-#line 439 "libmemcached/csl/parser.yy"
+#line 471 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1_32;
}
case 59:
/* Line 1806 of yacc.c */
-#line 443 "libmemcached/csl/parser.yy"
+#line 475 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1A_32;
}
case 60:
/* Line 1806 of yacc.c */
-#line 447 "libmemcached/csl/parser.yy"
+#line 479 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_HSIEH;
}
case 61:
/* Line 1806 of yacc.c */
-#line 451 "libmemcached/csl/parser.yy"
+#line 483 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_MURMUR;
}
case 62:
/* Line 1806 of yacc.c */
-#line 455 "libmemcached/csl/parser.yy"
+#line 487 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_JENKINS;
}
case 63:
/* Line 1806 of yacc.c */
-#line 462 "libmemcached/csl/parser.yy"
+#line 494 "libmemcached/csl/parser.yy"
{
(yyval.string)= (yyvsp[(1) - (1)].string);
}
case 64:
/* Line 1806 of yacc.c */
-#line 466 "libmemcached/csl/parser.yy"
+#line 498 "libmemcached/csl/parser.yy"
{
(yyval.string)= (yyvsp[(1) - (1)].string);
}
case 65:
/* Line 1806 of yacc.c */
-#line 473 "libmemcached/csl/parser.yy"
+#line 505 "libmemcached/csl/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_CONSISTENT;
}
case 66:
/* Line 1806 of yacc.c */
-#line 477 "libmemcached/csl/parser.yy"
+#line 509 "libmemcached/csl/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_MODULA;
}
case 67:
/* Line 1806 of yacc.c */
-#line 481 "libmemcached/csl/parser.yy"
+#line 513 "libmemcached/csl/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_RANDOM;
}
/* Line 1806 of yacc.c */
-#line 2156 "libmemcached/csl/parser.cc"
+#line 2172 "libmemcached/csl/parser.cc"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
/* Line 2067 of yacc.c */
-#line 486 "libmemcached/csl/parser.yy"
+#line 518 "libmemcached/csl/parser.yy"
void Context::start()