%token <number> FLOAT
%token <number> NUMBER
-%token PORT
-%token WEIGHT_START
+%token <number> PORT
+%token <number> WEIGHT_START
%token <server> IPADDRESS
%token <server> HOSTNAME
%token <string> STRING
%token <string> QUOTED_STRING
%token <string> FILE_PATH
-%type <string> string
-%type <distribution> distribution
-%type <hash> hash
%type <behavior> behavior_boolean
%type <behavior> behavior_number
+%type <distribution> distribution
+%type <hash> hash
+%type <number> optional_port
+%type <number> optional_weight
+%type <string> string
%%
expression:
SERVER HOSTNAME optional_port optional_weight
{
- if ((context->rc= memcached_server_add_with_weight(context->memc, $2.c_str, $2.port, $2.weight)) != MEMCACHED_SUCCESS)
+ if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, $2.c_str, $3, $4)))
{
parser_abort(context, NULL);
}
}
| SERVER IPADDRESS optional_port optional_weight
{
- if ((context->rc= memcached_server_add_with_weight(context->memc, $2.c_str, $2.port, $2.weight)) != MEMCACHED_SUCCESS)
+ if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, $2.c_str, $3, $4)))
{
parser_abort(context, NULL);
}
optional_port:
- { }
+ { $$= MEMCACHED_DEFAULT_PORT;}
| PORT
{ };
;
optional_weight:
- { }
+ { $$= 1; }
| WEIGHT_START
{ }
;