From 63f71170a4353e58f57f0572db83893cebc2ad91 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Sat, 26 Mar 2011 17:40:48 -0700 Subject: [PATCH] Shift = over being done by scanner, ie faster match. --- libmemcached/options/parser.yy | 16 ++++++++-------- libmemcached/options/scanner.l | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libmemcached/options/parser.yy b/libmemcached/options/parser.yy index 6145ec72..31371c1b 100644 --- a/libmemcached/options/parser.yy +++ b/libmemcached/options/parser.yy @@ -221,30 +221,30 @@ expression: ; behaviors: - PREFIX_KEY '=' string + PREFIX_KEY string { - if ((context->rc= memcached_set_prefix_key(context->memc, $3.c_str, $3.length)) != MEMCACHED_SUCCESS) + if ((context->rc= memcached_set_prefix_key(context->memc, $2.c_str, $2.length)) != MEMCACHED_SUCCESS) { parser_abort(context, NULL);; } } - | DISTRIBUTION '=' distribution + | DISTRIBUTION distribution { - if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, $3)) != MEMCACHED_SUCCESS) + if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, $2)) != MEMCACHED_SUCCESS) { parser_abort(context, NULL);; } } - | HASH '=' hash + | HASH hash { - if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_HASH, $3)) != MEMCACHED_SUCCESS) + if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_HASH, $2)) != MEMCACHED_SUCCESS) { parser_abort(context, NULL);; } } - | KETAMA_HASH '=' hash + | KETAMA_HASH hash { - if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, $3)) != MEMCACHED_SUCCESS) + if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, $2)) != MEMCACHED_SUCCESS) { parser_abort(context, NULL);; } diff --git a/libmemcached/options/scanner.l b/libmemcached/options/scanner.l index 67fdb96d..6e58f3f8 100644 --- a/libmemcached/options/scanner.l +++ b/libmemcached/options/scanner.l @@ -103,8 +103,8 @@ static void get_lex_chars(char* buffer, int& result, int max_size, Context *cont "--CONNECT_TIMEOUT" { yyextra->begin= yytext; return CONNECT_TIMEOUT; } "--CONNECT-TIMEOUT" { yyextra->begin= yytext; return CONNECT_TIMEOUT; } "--CORK" { yyextra->begin= yytext; return _CORK; } -"--DISTRIBUTION" { yyextra->begin= yytext; return DISTRIBUTION; } -"--HASH" { yyextra->begin= yytext; return HASH; } +"--DISTRIBUTION=" { yyextra->begin= yytext; return DISTRIBUTION; } +"--HASH=" { yyextra->begin= yytext; return HASH; } "--HASH_WITH_PREFIX_KEY" { yyextra->begin= yytext; return HASH_WITH_PREFIX_KEY; } "--HASH-WITH-PREFIX_KEY" { yyextra->begin= yytext; return HASH_WITH_PREFIX_KEY; } "--IO_BYTES_WATERMARK" { yyextra->begin= yytext; return IO_BYTES_WATERMARK; } @@ -114,8 +114,8 @@ static void get_lex_chars(char* buffer, int& result, int max_size, Context *cont "--IO_MSG_WATERMARK" { yyextra->begin= yytext; return IO_MSG_WATERMARK; } "--IO-MSG-WATERMARK" { yyextra->begin= yytext; return IO_MSG_WATERMARK; } "--KETAMA" { yyextra->begin= yytext; return KETAMA; } -"--KETAMA_HASH" { yyextra->begin= yytext; return KETAMA_HASH; } -"--KETAMA-HASH" { yyextra->begin= yytext; return KETAMA_HASH; } +"--KETAMA_HASH=" { yyextra->begin= yytext; return KETAMA_HASH; } +"--KETAMA-HASH=" { yyextra->begin= yytext; return KETAMA_HASH; } "--KETAMA_WEIGHTED" { yyextra->begin= yytext; return KETAMA_WEIGHTED; } "--KETAMA-WEIGHTED" { yyextra->begin= yytext; return KETAMA_WEIGHTED; } "--NOREPLY" { yyextra->begin= yytext; return NOREPLY; } @@ -152,8 +152,8 @@ static void get_lex_chars(char* buffer, int& result, int max_size, Context *cont "--USE_UDP" { yyextra->begin= yytext; return USE_UDP; } "--USE-UDP" { yyextra->begin= yytext; return USE_UDP; } -"--PREFIX-KEY" { yyextra->begin= yytext; return PREFIX_KEY; } -"--PREFIX_KEY" { yyextra->begin= yytext; return PREFIX_KEY; } +"--PREFIX-KEY=" { yyextra->begin= yytext; return PREFIX_KEY; } +"--PREFIX_KEY=" { yyextra->begin= yytext; return PREFIX_KEY; } INCLUDE { yyextra->begin= yytext; return INCLUDE; } RESET { yyextra->begin= yytext; return RESET; } -- 2.30.2