projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Merge in changes around setting up better syntax for distribution.
[awesomized/libmemcached]
/
libmemcached
/
options
/
parser.yy
diff --git
a/libmemcached/options/parser.yy
b/libmemcached/options/parser.yy
index fb7ccd8601a244872525d47349eebfb3a3c4de46..6aa477920ce5259444af0c33ece6eb5164a6e64f 100644
(file)
--- a/
libmemcached/options/parser.yy
+++ b/
libmemcached/options/parser.yy
@@
-25,7
+25,7
@@
%output "libmemcached/options/parser.cc"
%defines "libmemcached/options/parser.h"
%lex-param { yyscan_t *scanner }
%output "libmemcached/options/parser.cc"
%defines "libmemcached/options/parser.h"
%lex-param { yyscan_t *scanner }
-%name-prefix="
libmemcached
_"
+%name-prefix="
config
_"
%parse-param { Context *context }
%parse-param { yyscan_t *scanner }
%pure-parser
%parse-param { Context *context }
%parse-param { yyscan_t *scanner }
%pure-parser
@@
-49,20
+49,21
@@
#pragma GCC diagnostic ignored "-Wold-style-cast"
#include <libmemcached/options/scanner.h>
#pragma GCC diagnostic ignored "-Wold-style-cast"
#include <libmemcached/options/scanner.h>
-int
libmemcached
_lex(YYSTYPE* lvalp, void* scanner);
+int
conf
_lex(YYSTYPE* lvalp, void* scanner);
#define parser_abort(A, B) do { parser::abort_func((A), (B)); YYABORT; } while (0)
#define parser_abort(A, B) do { parser::abort_func((A), (B)); YYABORT; } while (0)
-inline void
libmemcached
_error(Context *context, yyscan_t *scanner, const char *error)
+inline void
config
_error(Context *context, yyscan_t *scanner, const char *error)
{
if (not context->end())
parser::abort_func(context, error);
}
{
if (not context->end())
parser::abort_func(context, error);
}
-int libmemcached_parse(Context*, yyscan_t *);
+int config_parse(Context*, yyscan_t *);
+
void Context::start()
{
void Context::start()
{
-
libmemcached
_parse(this, scanner);
+
config
_parse(this, scanner);
}
%}
}
%}
@@
-87,14
+88,12
@@
void Context::start()
%token BUFFER_REQUESTS
%token CACHE_LOOKUPS
%token CONNECT_TIMEOUT
%token BUFFER_REQUESTS
%token CACHE_LOOKUPS
%token CONNECT_TIMEOUT
-%token _CORK
%token DISTRIBUTION
%token HASH
%token HASH_WITH_PREFIX_KEY
%token IO_BYTES_WATERMARK
%token IO_KEY_PREFETCH
%token IO_MSG_WATERMARK
%token DISTRIBUTION
%token HASH
%token HASH_WITH_PREFIX_KEY
%token IO_BYTES_WATERMARK
%token IO_KEY_PREFETCH
%token IO_MSG_WATERMARK
-%token KETAMA
%token KETAMA_HASH
%token KETAMA_WEIGHTED
%token NOREPLY
%token KETAMA_HASH
%token KETAMA_WEIGHTED
%token NOREPLY
@@
-202,55
+201,59
@@
statement:
expression:
expression:
- SERVER
'='
server
+ SERVER server
{
{
- if ((context->rc= memcached_server_add_parsed(context->memc, $
3.c_str, $3.length, $3
.port, 0)) != MEMCACHED_SUCCESS)
+ if ((context->rc= memcached_server_add_parsed(context->memc, $
2.c_str, $2.length, $2
.port, 0)) != MEMCACHED_SUCCESS)
{
parser_abort(context, NULL);
}
}
{
parser_abort(context, NULL);
}
}
- | SERVERS_OPTION
'='
server_list
+ | SERVERS_OPTION server_list
{
}
{
}
- | CONFIGURE_FILE
'='
string
+ | CONFIGURE_FILE string
{
{
- memcached_set_configuration_file(context->memc, $
3.c_str, $3
.length);
+ memcached_set_configuration_file(context->memc, $
2.c_str, $2
.length);
}
| behaviors
;
behaviors:
}
| behaviors
;
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);;
}
}
{
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);;
}
}
{
parser_abort(context, NULL);;
}
}
- |
HASH '=
' hash
+ |
DISTRIBUTION distribution ',
' 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_
DISTRIBUTION, $2
)) != MEMCACHED_SUCCESS)
{
{
- parser_abort(context, NULL);;
+ parser_abort(context, NULL);;
+ }
+ if ((context->rc= memcached_behavior_set_distribution_hash(context->memc, $4)) != MEMCACHED_SUCCESS)
+ {
+ parser_abort(context, NULL);;
}
}
}
}
- |
KETAMA_HASH '='
hash
+ |
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_
HASH, $2
)) != MEMCACHED_SUCCESS)
{
{
- parser_abort(context, NULL);;
+ parser_abort(context, NULL);;
}
}
}
}
- | behavior_number
'='
NUMBER
+ | behavior_number NUMBER
{
{
- if ((context->rc= memcached_behavior_set(context->memc, $1, $
3
)) != MEMCACHED_SUCCESS)
+ if ((context->rc= memcached_behavior_set(context->memc, $1, $
2
)) != MEMCACHED_SUCCESS)
{
parser_abort(context, NULL);;
}
{
parser_abort(context, NULL);;
}
@@
-335,18
+338,10
@@
behavior_boolean:
{
$$= MEMCACHED_BEHAVIOR_CACHE_LOOKUPS;
}
{
$$= MEMCACHED_BEHAVIOR_CACHE_LOOKUPS;
}
- | _CORK
- {
- $$= MEMCACHED_BEHAVIOR_CORK;
- }
| HASH_WITH_PREFIX_KEY
{
$$= MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY;
}
| HASH_WITH_PREFIX_KEY
{
$$= MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY;
}
- | KETAMA
- {
- $$= MEMCACHED_BEHAVIOR_KETAMA;
- }
| KETAMA_WEIGHTED
{
$$= MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED;
| KETAMA_WEIGHTED
{
$$= MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED;