4 #pragma GCC diagnostic ignored "-Wold-style-cast"
5 #pragma GCC diagnostic ignored "-Wunused-parameter"
6 #pragma GCC diagnostic ignored "-fpermissive"
8 #include <libmemcached/options/parser.h>
9 #include <libmemcached/options/string.h>
10 #include <libmemcached/options/symbol.h>
11 #include <libmemcached/options/type.h>
20 #define PARAM yyget_extra(yyscanner)
22 static void get_lex_chars(char* buffer, int& result, int max_size, struct type_st *parser)
24 if (parser->pos >= parser->length)
30 result = parser->length - parser->pos;
31 result > (int)max_size ? result = max_size : 0;
32 memcpy(buffer, parser->buf + parser->pos, result);
33 parser->pos += result;
38 #define YY_INPUT(buffer, result, max_size) get_lex_chars(buffer, result, max_size, PARAM)
42 %option bison-locations
44 %option case-insensitive
48 %option outfile="libmemcached/options/scanner.cc" header-file="libmemcached/options/scanner.h"
50 %option prefix="libmemcached_"
58 [0-9]+ { yylval->number = atoi(yytext); return (NUMBER); }
60 ([0-9]*.[0-9]+) { yylval->double_number = atof(yytext); return (FLOAT); }
62 [ \t\r\n] ; /* skip whitespace */
64 "--SERVER" { return SERVER; }
65 "--SERVERS" { return SERVERS; }
66 "--TCP_NODELAY" { return TCPNODELAY; }
67 "--TCP-NODELAY" { return TCPNODELAY; }
68 "--VERIFY_KEY" { return VERIFY_KEY; }
69 "--VERIFY-KEY" { return VERIFY_KEY; }
71 [A-Za-z][A-Za-z0-9_]*[:] {
72 yylval->string.c_str = yytext;
73 yylval->string.length = yyleng;
74 return SERVER_WITH_PORT;
77 [A-Za-z][A-Za-z0-9_]* {
78 yylval->string.c_str = yytext;
79 yylval->string.length = yyleng;
85 std::cerr << "Near " << yytext << std::endl;