From: Brian Aker Date: Thu, 8 Sep 2011 20:34:41 +0000 (-0700) Subject: Update scanner X-Git-Tag: 0.52~7 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=026339d350e4cbec41951eea4d64bda5caf9febc;p=m6w6%2Flibmemcached Update scanner --- diff --git a/libmemcached/csl/scanner.cc b/libmemcached/csl/scanner.cc index 9d952463..254dda92 100644 --- a/libmemcached/csl/scanner.cc +++ b/libmemcached/csl/scanner.cc @@ -229,11 +229,6 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - /* %if-not-reentrant */ /* %endif */ @@ -264,6 +259,11 @@ typedef size_t yy_size_t; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -286,7 +286,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -383,7 +383,7 @@ static void config__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanne YY_BUFFER_STATE config__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE config__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); /* %endif */ @@ -1188,8 +1188,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - yy_size_t yy_n_chars; - yy_size_t yyleng_r; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -1252,7 +1252,7 @@ FILE *config_get_out (yyscan_t yyscanner ); void config_set_out (FILE * out_str ,yyscan_t yyscanner ); -yy_size_t config_get_leng (yyscan_t yyscanner ); +int config_get_leng (yyscan_t yyscanner ); char *config_get_text (yyscan_t yyscanner ); @@ -1260,6 +1260,10 @@ int config_get_lineno (yyscan_t yyscanner ); void config_set_lineno (int line_number ,yyscan_t yyscanner ); +int config_get_column (yyscan_t yyscanner ); + +void config_set_column (int column_no ,yyscan_t yyscanner ); + /* %if-bison-bridge */ YYSTYPE * config_get_lval (yyscan_t yyscanner ); @@ -1323,7 +1327,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) /* %endif */ /* %if-c++-only C++ definition */ /* %endif */ @@ -1338,7 +1342,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1455,7 +1459,7 @@ YY_DECL -#line 1459 "libmemcached/csl/scanner.cc" +#line 1463 "libmemcached/csl/scanner.cc" yylval = yylval_param; @@ -1938,7 +1942,7 @@ YY_RULE_SETUP #line 201 "libmemcached/csl/scanner.l" ECHO; YY_BREAK -#line 1942 "libmemcached/csl/scanner.cc" +#line 1946 "libmemcached/csl/scanner.cc" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2138,7 +2142,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -2152,7 +2156,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2183,7 +2187,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); + yyg->yy_n_chars, (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -2330,7 +2334,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -2354,7 +2358,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) case EOB_ACT_END_OF_FILE: { if ( config_wrap(yyscanner ) ) - return 0; + return EOF; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -2676,7 +2680,7 @@ static void config_ensure_buffer_stack (yyscan_t yyscanner) /* %if-c++-only */ /* %endif */ { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -2780,11 +2784,12 @@ YY_BUFFER_STATE config__scan_string (yyconst char * yystr , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE config__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE config__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2904,7 +2909,7 @@ FILE *config_get_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t config_get_leng (yyscan_t yyscanner) +int config_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; diff --git a/libmemcached/csl/scanner.h b/libmemcached/csl/scanner.h index 9262e5f8..6f28e20e 100644 --- a/libmemcached/csl/scanner.h +++ b/libmemcached/csl/scanner.h @@ -190,11 +190,6 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - /* %if-not-reentrant */ /* %endif */ @@ -203,6 +198,11 @@ typedef size_t yy_size_t; /* %endif */ /* %endif */ +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -225,7 +225,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -281,7 +281,7 @@ void config_pop_buffer_state (yyscan_t yyscanner ); YY_BUFFER_STATE config__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE config__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE config__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); /* %endif */ @@ -362,7 +362,7 @@ FILE *config_get_out (yyscan_t yyscanner ); void config_set_out (FILE * out_str ,yyscan_t yyscanner ); -yy_size_t config_get_leng (yyscan_t yyscanner ); +int config_get_leng (yyscan_t yyscanner ); char *config_get_text (yyscan_t yyscanner ); @@ -370,6 +370,10 @@ int config_get_lineno (yyscan_t yyscanner ); void config_set_lineno (int line_number ,yyscan_t yyscanner ); +int config_get_column (yyscan_t yyscanner ); + +void config_set_column (int column_no ,yyscan_t yyscanner ); + /* %if-bison-bridge */ YYSTYPE * config_get_lval (yyscan_t yyscanner ); @@ -472,6 +476,6 @@ extern int config_lex \ #line 201 "libmemcached/csl/scanner.l" -#line 476 "libmemcached/csl/scanner.h" +#line 480 "libmemcached/csl/scanner.h" #undef config_IN_HEADER #endif /* config_HEADER_H */