From f8a68ab4cb01bae30a33ca13b343666410dd26fe Mon Sep 17 00:00:00 2001 From: Koschei Date: Wed, 9 Oct 2024 19:05:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=9D=E6=AD=A5=E5=AE=9E=E7=8E=B0=20?= =?UTF-8?q?update-mvcc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/observer/sql/parser/lex_sql.cpp | 5453 +++++++++++------ src/observer/sql/parser/lex_sql.h | 244 +- src/observer/sql/parser/yacc_sql.cpp | 4694 +++++++++----- src/observer/sql/parser/yacc_sql.hpp | 223 +- .../storage/record/record_manager.cpp | 2 +- src/observer/storage/record/record_manager.h | 2 +- src/observer/storage/table/table.cpp | 4 +- src/observer/storage/table/table.h | 2 +- src/observer/storage/trx/mvcc_trx.cpp | 110 +- src/observer/storage/trx/mvcc_trx.h | 2 +- src/observer/storage/trx/trx.h | 26 +- 11 files changed, 7267 insertions(+), 3495 deletions(-) diff --git a/src/observer/sql/parser/lex_sql.cpp b/src/observer/sql/parser/lex_sql.cpp index ee7225ed..5777e557 100644 --- a/src/observer/sql/parser/lex_sql.cpp +++ b/src/observer/sql/parser/lex_sql.cpp @@ -8,23 +8,21 @@ typedef int yy_size_t; /* 参考生成的lex_sql.cpp代码,这个宏定义会放在每次运行yylex()最开始的地方 */ -#define YY_USER_INIT \ - yycolumn = 0; +#define YY_USER_INIT yycolumn = 0; /* 参考生成的lex_sql.cpp代码,这个宏定义会放在解析一个token之后,也可以在网上找到大量的参考资料 */ /* 我们在这里设置当前解析的token的位置信息,这样在yacc中就可以使用这些信息了 */ -#define YY_USER_ACTION \ -do { \ - yylloc->first_line = yylloc->last_line = yylineno; \ - yylloc->first_column = yycolumn; \ - yylloc->last_column = yylloc->first_column + yyleng - 1; \ - yycolumn += yyleng; \ -} \ -while (0); +#define YY_USER_ACTION \ + do { \ + yylloc->first_line = yylloc->last_line = yylineno; \ + yylloc->first_column = yycolumn; \ + yylloc->last_column = yylloc->first_column + yyleng - 1; \ + yycolumn += yyleng; \ + } while (0); #line 25 "lex_sql.cpp" -#define YY_INT_ALIGNED short int +#define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ @@ -77,62 +75,62 @@ while (0); /* C99 systems have . Non-C99 systems may or may not. */ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. + * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; +typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; typedef uint64_t flex_uint64_t; #else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; +typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN -#define INT8_MIN (-128) +#define INT8_MIN (-128) #endif #ifndef INT16_MIN -#define INT16_MIN (-32767-1) +#define INT16_MIN (-32767 - 1) #endif #ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) +#define INT32_MIN (-2147483647 - 1) #endif #ifndef INT8_MAX -#define INT8_MAX (127) +#define INT8_MAX (127) #endif #ifndef INT16_MAX -#define INT16_MAX (32767) +#define INT16_MAX (32767) #endif #ifndef INT32_MAX -#define INT32_MAX (2147483647) +#define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX -#define UINT8_MAX (255U) +#define UINT8_MAX (255U) #endif #ifndef UINT16_MAX -#define UINT16_MAX (65535U) +#define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) +#define UINT32_MAX (4294967295U) #endif #ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) +#define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ @@ -156,12 +154,12 @@ typedef unsigned int flex_uint32_t; /* Promotes a possibly negative, possibly signed char to an * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) +#define YY_SC_TO_UI(c) ((YY_CHAR)(c)) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T -typedef void* yyscan_t; +typedef void *yyscan_t; #endif /* For convenience, these vars (plus the bison vars far below) @@ -189,7 +187,7 @@ typedef void* yyscan_t; /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin , yyscanner ) +#define YY_NEW_FILE yyrestart(yyin, yyscanner) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -207,7 +205,7 @@ typedef void* yyscan_t; /* The state buf must be large enough to hold one state per character in the main buffer. */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE @@ -222,88 +220,85 @@ typedef size_t yy_size_t; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) - + +#define YY_LESS_LINENO(n) +#define YY_LINENO_REWIND_TO(ptr) + /* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = yyg->yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) -#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) +#define yyless(n) \ + do { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg); \ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } while (0) +#define unput(c) yyunput(c, yyg->yytext_ptr, yyscanner) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - int yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t 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 - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; +{ + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t 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 + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - - }; +}; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* We provide macros for accessing buffer states in case in the @@ -312,59 +307,55 @@ struct yy_buffer_state * * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ - ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ - : NULL) +#define YY_CURRENT_BUFFER (yyg->yy_buffer_stack ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] -void yyrestart ( FILE *input_file , yyscan_t yyscanner ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); -void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -void yypop_buffer_state ( yyscan_t yyscanner ); +void yyrestart(FILE *input_file, yyscan_t yyscanner); +void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); +YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner); +void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner); +void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner); +void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); +void yypop_buffer_state(yyscan_t yyscanner); -static void yyensure_buffer_stack ( yyscan_t yyscanner ); -static void yy_load_buffer_state ( yyscan_t yyscanner ); -static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) +static void yyensure_buffer_stack(yyscan_t yyscanner); +static void yy_load_buffer_state(yyscan_t yyscanner); +static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner); +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER, yyscanner) -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner); +YY_BUFFER_STATE yy_scan_string(const char *yy_str, yyscan_t yyscanner); +YY_BUFFER_STATE yy_scan_bytes(const char *bytes, yy_size_t len, yyscan_t yyscanner); -void *yyalloc ( yy_size_t , yyscan_t yyscanner ); -void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); -void yyfree ( void * , yyscan_t yyscanner ); +void *yyalloc(yy_size_t, yyscan_t yyscanner); +void *yyrealloc(void *, yy_size_t, yyscan_t yyscanner); +void yyfree(void *, yyscan_t yyscanner); #define yy_new_buffer yy_create_buffer -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (yyscanner); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (yyscanner); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } +#define yy_set_interactive(is_interactive) \ + { \ + if (!YY_CURRENT_BUFFER) { \ + yyensure_buffer_stack(yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if (!YY_CURRENT_BUFFER) { \ + yyensure_buffer_stack(yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define yywrap(yyscanner) (/*CONSTCOND*/1) +#define yywrap(yyscanner) (/*CONSTCOND*/ 1) #define YY_SKIP_YYWRAP typedef flex_uint8_t YY_CHAR; @@ -372,314 +363,2404 @@ typedef int yy_state_type; #define yytext_ptr yytext_r -static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); -static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); -static int yy_get_next_buffer ( yyscan_t yyscanner ); -static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); +static yy_state_type yy_get_previous_state(yyscan_t yyscanner); +static yy_state_type yy_try_NUL_trans(yy_state_type current_state, yyscan_t yyscanner); +static int yy_get_next_buffer(yyscan_t yyscanner); +static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ -#define YY_DO_BEFORE_ACTION \ - yyg->yytext_ptr = yy_bp; \ - yyleng = (yy_size_t) (yy_cp - yy_bp); \ - yyg->yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yyg->yy_c_buf_p = yy_cp; +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (yy_size_t)(yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; #define YY_NUM_RULES 77 #define YY_END_OF_BUFFER 78 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static const flex_int16_t yy_accept[222] = - { 0, - 0, 0, 0, 0, 78, 76, 1, 2, 76, 76, - 76, 56, 57, 72, 70, 58, 71, 6, 73, 3, - 5, 63, 59, 65, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 77, 62, 0, 74, 0, 75, - 3, 0, 60, 61, 64, 69, 69, 69, 48, 69, - 47, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 50, 67, 69, 69, 69, 69, - 69, 15, 23, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 4, 22, 49, 69, 69, 69, - - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 33, 69, 69, - 69, 66, 69, 69, 69, 69, 29, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 19, 34, 69, - 69, 42, 36, 69, 9, 11, 69, 7, 69, 69, - 69, 20, 69, 8, 69, 69, 69, 69, 25, 55, - 68, 41, 39, 69, 69, 69, 16, 69, 17, 69, - 37, 69, 69, 69, 69, 30, 69, 69, 69, 69, - 69, 35, 69, 45, 14, 69, 54, 69, 69, 46, - 69, 69, 69, 12, 69, 69, 69, 21, 31, 10, - - 27, 51, 69, 53, 43, 24, 69, 69, 18, 69, - 13, 38, 28, 26, 44, 69, 69, 52, 40, 32, - 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, - 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 5, 1, 1, 1, 1, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 1, 16, 17, - 18, 19, 1, 1, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 1, 1, 1, 1, 45, 1, 46, 47, 48, 49, - - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 45, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static const YY_CHAR yy_meta[71] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 - } ; - -static const flex_int16_t yy_base[227] = - { 0, - 0, 0, 0, 0, 601, 602, 602, 602, 582, 594, - 592, 602, 602, 602, 602, 602, 582, 602, 602, 58, - 602, 56, 602, 578, 57, 61, 62, 63, 64, 83, - 65, 69, 91, 76, 580, 117, 108, 97, 103, 120, - 134, 146, 137, 112, 602, 602, 589, 602, 587, 602, - 73, 577, 602, 602, 602, 0, 576, 152, 147, 161, - 575, 151, 171, 157, 173, 163, 178, 177, 184, 188, - 181, 191, 195, 183, 241, 567, 205, 206, 211, 185, - 212, 566, 224, 215, 237, 226, 243, 234, 250, 238, - 255, 272, 260, 239, 565, 564, 563, 270, 286, 267, - - 281, 295, 296, 299, 297, 303, 312, 313, 311, 320, - 321, 307, 325, 339, 328, 343, 344, 314, 322, 347, - 346, 562, 357, 351, 365, 368, 560, 369, 350, 376, - 375, 370, 263, 384, 385, 390, 387, 559, 557, 388, - 392, 555, 554, 395, 553, 552, 397, 550, 406, 400, - 408, 549, 414, 548, 402, 425, 404, 418, 547, 545, - 541, 540, 423, 429, 443, 446, 538, 457, 537, 435, - 534, 433, 448, 455, 459, 528, 461, 465, 469, 463, - 476, 524, 471, 516, 480, 473, 432, 481, 487, 393, - 491, 483, 492, 497, 501, 509, 502, 318, 317, 273, - - 269, 246, 499, 219, 217, 189, 514, 506, 179, 523, - 138, 126, 123, 89, 88, 526, 527, 86, 82, 79, - 602, 583, 585, 587, 90, 79 - } ; - -static const flex_int16_t yy_def[227] = - { 0, - 221, 1, 222, 222, 221, 221, 221, 221, 221, 223, - 224, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 221, 221, 223, 221, 224, 221, - 221, 221, 221, 221, 221, 226, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 221, 225, 225, 225, 225, 225, - - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 0, 221, 221, 221, 221, 221 - } ; - -static const flex_int16_t yy_nxt[673] = - { 0, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 35, 37, 38, 35, 35, 39, 40, 41, 42, - 43, 44, 35, 35, 35, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 35, 37, 38, - 35, 35, 39, 40, 41, 42, 43, 44, 35, 35, - 52, 56, 51, 53, 54, 56, 56, 56, 56, 56, - 56, 62, 66, 56, 60, 52, 67, 51, 63, 58, - 56, 57, 74, 56, 59, 64, 56, 56, 65, 68, - - 56, 73, 56, 56, 61, 56, 69, 62, 66, 77, - 60, 56, 67, 70, 63, 58, 71, 56, 74, 72, - 59, 64, 56, 75, 65, 68, 56, 73, 76, 82, - 61, 56, 69, 83, 56, 77, 84, 56, 94, 70, - 56, 80, 71, 85, 78, 72, 86, 81, 56, 75, - 79, 56, 56, 89, 76, 82, 93, 90, 87, 83, - 56, 56, 84, 88, 94, 56, 56, 80, 97, 85, - 78, 56, 86, 81, 96, 56, 79, 56, 91, 89, - 92, 99, 93, 90, 87, 56, 98, 56, 101, 88, - 100, 56, 56, 56, 97, 56, 102, 56, 56, 56, - - 96, 103, 56, 56, 91, 56, 92, 99, 104, 56, - 106, 107, 98, 113, 101, 105, 100, 110, 108, 56, - 56, 109, 102, 122, 111, 56, 56, 103, 112, 56, - 121, 56, 119, 56, 104, 120, 106, 107, 56, 113, - 56, 105, 123, 110, 108, 125, 124, 109, 56, 122, - 111, 56, 56, 56, 112, 56, 121, 56, 119, 128, - 56, 120, 136, 114, 56, 115, 130, 126, 123, 56, - 131, 125, 124, 116, 56, 127, 129, 56, 117, 118, - 132, 56, 133, 56, 56, 128, 56, 56, 136, 114, - 135, 115, 130, 126, 134, 56, 131, 137, 172, 116, - - 56, 127, 129, 139, 117, 118, 132, 138, 133, 56, - 56, 56, 140, 56, 141, 142, 135, 56, 145, 143, - 134, 56, 144, 137, 172, 56, 56, 56, 56, 139, - 150, 56, 56, 138, 56, 56, 56, 146, 140, 56, - 141, 142, 56, 149, 145, 143, 153, 159, 144, 147, - 148, 151, 152, 56, 160, 156, 150, 56, 56, 154, - 56, 56, 155, 146, 56, 56, 157, 158, 162, 149, - 161, 56, 153, 159, 164, 147, 148, 151, 152, 56, - 160, 156, 56, 56, 56, 154, 168, 163, 155, 56, - 56, 166, 157, 158, 162, 165, 161, 169, 56, 56, - - 164, 56, 56, 173, 56, 170, 56, 56, 171, 56, - 167, 56, 168, 163, 56, 177, 56, 166, 56, 176, - 56, 165, 56, 169, 174, 181, 175, 183, 56, 173, - 178, 170, 56, 179, 171, 180, 167, 56, 182, 56, - 187, 177, 189, 56, 185, 176, 56, 56, 184, 56, - 174, 181, 175, 183, 188, 186, 178, 56, 194, 179, - 56, 180, 56, 191, 182, 190, 187, 192, 189, 56, - 185, 56, 195, 56, 184, 56, 193, 56, 197, 56, - 188, 186, 198, 56, 194, 56, 196, 56, 200, 191, - 56, 190, 201, 192, 56, 56, 205, 56, 195, 199, - - 202, 56, 193, 203, 197, 56, 56, 207, 198, 204, - 208, 56, 196, 56, 200, 56, 56, 210, 201, 206, - 56, 209, 205, 56, 212, 199, 202, 217, 56, 203, - 56, 215, 213, 207, 211, 204, 208, 56, 56, 214, - 56, 56, 56, 210, 216, 206, 218, 209, 56, 219, - 212, 56, 56, 217, 56, 56, 220, 215, 213, 56, - 211, 56, 56, 56, 56, 214, 56, 56, 56, 56, - 216, 56, 218, 56, 56, 219, 56, 56, 56, 95, - 56, 56, 220, 45, 45, 47, 47, 49, 49, 56, - 56, 95, 50, 48, 56, 55, 51, 50, 48, 46, - - 221, 5, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221 - } ; - -static const flex_int16_t yy_chk[673] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 20, 25, 20, 22, 22, 26, 27, 28, 29, 31, - 226, 27, 28, 32, 26, 51, 28, 51, 27, 25, - 34, 225, 32, 220, 25, 27, 219, 30, 27, 28, - - 218, 31, 215, 214, 26, 33, 29, 27, 28, 34, - 26, 38, 28, 30, 27, 25, 30, 39, 32, 30, - 25, 27, 37, 33, 27, 28, 44, 31, 33, 38, - 26, 36, 29, 38, 40, 34, 39, 213, 44, 30, - 212, 37, 30, 40, 36, 30, 40, 37, 41, 33, - 36, 43, 211, 41, 33, 38, 43, 41, 40, 38, - 42, 59, 39, 40, 44, 62, 58, 37, 59, 40, - 36, 64, 40, 37, 58, 60, 36, 66, 42, 41, - 42, 62, 43, 41, 40, 63, 60, 65, 64, 40, - 63, 68, 67, 209, 59, 71, 65, 74, 69, 80, - - 58, 66, 70, 206, 42, 72, 42, 62, 67, 73, - 68, 69, 60, 74, 64, 67, 63, 71, 69, 77, - 78, 70, 65, 80, 72, 79, 81, 66, 73, 84, - 79, 205, 77, 204, 67, 78, 68, 69, 83, 74, - 86, 67, 81, 71, 69, 84, 83, 70, 88, 80, - 72, 85, 90, 94, 73, 75, 79, 87, 77, 86, - 202, 78, 94, 75, 89, 75, 88, 85, 81, 91, - 89, 84, 83, 75, 93, 85, 87, 133, 75, 75, - 90, 100, 91, 201, 98, 86, 92, 200, 94, 75, - 93, 75, 88, 85, 92, 101, 89, 98, 133, 75, - - 99, 85, 87, 100, 75, 75, 90, 99, 91, 102, - 103, 105, 101, 104, 102, 103, 93, 106, 105, 103, - 92, 112, 104, 98, 133, 109, 107, 108, 118, 100, - 109, 199, 198, 99, 110, 111, 119, 106, 101, 113, - 102, 103, 115, 108, 105, 103, 112, 118, 104, 107, - 107, 110, 111, 114, 119, 115, 109, 116, 117, 113, - 121, 120, 114, 106, 129, 124, 116, 117, 121, 108, - 120, 123, 112, 118, 124, 107, 107, 110, 111, 125, - 119, 115, 126, 128, 132, 113, 129, 123, 114, 131, - 130, 126, 116, 117, 121, 125, 120, 130, 134, 135, - - 124, 137, 140, 134, 136, 131, 141, 190, 132, 144, - 128, 147, 129, 123, 150, 140, 155, 126, 157, 137, - 149, 125, 151, 130, 135, 149, 136, 151, 153, 134, - 141, 131, 158, 144, 132, 147, 128, 163, 150, 156, - 157, 140, 163, 164, 155, 137, 187, 172, 153, 170, - 135, 149, 136, 151, 158, 156, 141, 165, 170, 144, - 166, 147, 173, 165, 150, 164, 157, 166, 163, 174, - 155, 168, 172, 175, 153, 177, 168, 180, 174, 178, - 158, 156, 175, 179, 170, 183, 173, 186, 178, 165, - 181, 164, 179, 166, 185, 188, 186, 192, 172, 177, - - 180, 189, 168, 181, 174, 191, 193, 189, 175, 183, - 191, 194, 173, 203, 178, 195, 197, 193, 179, 188, - 208, 192, 186, 196, 195, 177, 180, 208, 207, 181, - 184, 203, 196, 189, 194, 183, 191, 210, 182, 197, - 216, 217, 176, 193, 207, 188, 210, 192, 171, 216, - 195, 169, 167, 208, 162, 161, 217, 203, 196, 160, - 194, 159, 154, 152, 148, 197, 146, 145, 143, 142, - 207, 139, 210, 138, 127, 216, 122, 97, 96, 95, - 82, 76, 217, 222, 222, 223, 223, 224, 224, 61, - 57, 52, 49, 47, 35, 24, 17, 11, 10, 9, - - 5, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, - 221, 221 - } ; +{ + flex_int32_t yy_verify; + flex_int32_t yy_nxt; +}; +static const flex_int16_t yy_accept[222] = {0, + 0, + 0, + 0, + 0, + 78, + 76, + 1, + 2, + 76, + 76, + 76, + 56, + 57, + 72, + 70, + 58, + 71, + 6, + 73, + 3, + 5, + 63, + 59, + 65, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 77, + 62, + 0, + 74, + 0, + 75, + 3, + 0, + 60, + 61, + 64, + 69, + 69, + 69, + 48, + 69, + 47, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 50, + 67, + 69, + 69, + 69, + 69, + 69, + 15, + 23, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 4, + 22, + 49, + 69, + 69, + 69, + + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 33, + 69, + 69, + 69, + 66, + 69, + 69, + 69, + 69, + 29, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 69, + 19, + 34, + 69, + 69, + 42, + 36, + 69, + 9, + 11, + 69, + 7, + 69, + 69, + 69, + 20, + 69, + 8, + 69, + 69, + 69, + 69, + 25, + 55, + 68, + 41, + 39, + 69, + 69, + 69, + 16, + 69, + 17, + 69, + 37, + 69, + 69, + 69, + 69, + 30, + 69, + 69, + 69, + 69, + 69, + 35, + 69, + 45, + 14, + 69, + 54, + 69, + 69, + 46, + 69, + 69, + 69, + 12, + 69, + 69, + 69, + 21, + 31, + 10, + + 27, + 51, + 69, + 53, + 43, + 24, + 69, + 69, + 18, + 69, + 13, + 38, + 28, + 26, + 44, + 69, + 69, + 52, + 40, + 32, + 0}; + +static const YY_CHAR yy_ec[256] = {0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 3, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 4, + 5, + 1, + 1, + 1, + 1, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 15, + 1, + 16, + 17, + 18, + 19, + 1, + 1, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 1, + 1, + 1, + 1, + 45, + 1, + 46, + 47, + 48, + 49, + + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 45, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1}; + +static const YY_CHAR yy_meta[71] = {0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2}; + +static const flex_int16_t yy_base[227] = {0, + 0, + 0, + 0, + 0, + 601, + 602, + 602, + 602, + 582, + 594, + 592, + 602, + 602, + 602, + 602, + 602, + 582, + 602, + 602, + 58, + 602, + 56, + 602, + 578, + 57, + 61, + 62, + 63, + 64, + 83, + 65, + 69, + 91, + 76, + 580, + 117, + 108, + 97, + 103, + 120, + 134, + 146, + 137, + 112, + 602, + 602, + 589, + 602, + 587, + 602, + 73, + 577, + 602, + 602, + 602, + 0, + 576, + 152, + 147, + 161, + 575, + 151, + 171, + 157, + 173, + 163, + 178, + 177, + 184, + 188, + 181, + 191, + 195, + 183, + 241, + 567, + 205, + 206, + 211, + 185, + 212, + 566, + 224, + 215, + 237, + 226, + 243, + 234, + 250, + 238, + 255, + 272, + 260, + 239, + 565, + 564, + 563, + 270, + 286, + 267, + + 281, + 295, + 296, + 299, + 297, + 303, + 312, + 313, + 311, + 320, + 321, + 307, + 325, + 339, + 328, + 343, + 344, + 314, + 322, + 347, + 346, + 562, + 357, + 351, + 365, + 368, + 560, + 369, + 350, + 376, + 375, + 370, + 263, + 384, + 385, + 390, + 387, + 559, + 557, + 388, + 392, + 555, + 554, + 395, + 553, + 552, + 397, + 550, + 406, + 400, + 408, + 549, + 414, + 548, + 402, + 425, + 404, + 418, + 547, + 545, + 541, + 540, + 423, + 429, + 443, + 446, + 538, + 457, + 537, + 435, + 534, + 433, + 448, + 455, + 459, + 528, + 461, + 465, + 469, + 463, + 476, + 524, + 471, + 516, + 480, + 473, + 432, + 481, + 487, + 393, + 491, + 483, + 492, + 497, + 501, + 509, + 502, + 318, + 317, + 273, + + 269, + 246, + 499, + 219, + 217, + 189, + 514, + 506, + 179, + 523, + 138, + 126, + 123, + 89, + 88, + 526, + 527, + 86, + 82, + 79, + 602, + 583, + 585, + 587, + 90, + 79}; + +static const flex_int16_t yy_def[227] = {0, + 221, + 1, + 222, + 222, + 221, + 221, + 221, + 221, + 221, + 223, + 224, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 221, + 221, + 223, + 221, + 224, + 221, + 221, + 221, + 221, + 221, + 221, + 226, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 221, + 225, + 225, + 225, + 225, + 225, + + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 225, + 0, + 221, + 221, + 221, + 221, + 221}; + +static const flex_int16_t yy_nxt[673] = {0, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 35, + 37, + 38, + 35, + 35, + 39, + 40, + 41, + 42, + 43, + 44, + 35, + 35, + 35, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 35, + 37, + 38, + 35, + 35, + 39, + 40, + 41, + 42, + 43, + 44, + 35, + 35, + 52, + 56, + 51, + 53, + 54, + 56, + 56, + 56, + 56, + 56, + 56, + 62, + 66, + 56, + 60, + 52, + 67, + 51, + 63, + 58, + 56, + 57, + 74, + 56, + 59, + 64, + 56, + 56, + 65, + 68, + + 56, + 73, + 56, + 56, + 61, + 56, + 69, + 62, + 66, + 77, + 60, + 56, + 67, + 70, + 63, + 58, + 71, + 56, + 74, + 72, + 59, + 64, + 56, + 75, + 65, + 68, + 56, + 73, + 76, + 82, + 61, + 56, + 69, + 83, + 56, + 77, + 84, + 56, + 94, + 70, + 56, + 80, + 71, + 85, + 78, + 72, + 86, + 81, + 56, + 75, + 79, + 56, + 56, + 89, + 76, + 82, + 93, + 90, + 87, + 83, + 56, + 56, + 84, + 88, + 94, + 56, + 56, + 80, + 97, + 85, + 78, + 56, + 86, + 81, + 96, + 56, + 79, + 56, + 91, + 89, + 92, + 99, + 93, + 90, + 87, + 56, + 98, + 56, + 101, + 88, + 100, + 56, + 56, + 56, + 97, + 56, + 102, + 56, + 56, + 56, + + 96, + 103, + 56, + 56, + 91, + 56, + 92, + 99, + 104, + 56, + 106, + 107, + 98, + 113, + 101, + 105, + 100, + 110, + 108, + 56, + 56, + 109, + 102, + 122, + 111, + 56, + 56, + 103, + 112, + 56, + 121, + 56, + 119, + 56, + 104, + 120, + 106, + 107, + 56, + 113, + 56, + 105, + 123, + 110, + 108, + 125, + 124, + 109, + 56, + 122, + 111, + 56, + 56, + 56, + 112, + 56, + 121, + 56, + 119, + 128, + 56, + 120, + 136, + 114, + 56, + 115, + 130, + 126, + 123, + 56, + 131, + 125, + 124, + 116, + 56, + 127, + 129, + 56, + 117, + 118, + 132, + 56, + 133, + 56, + 56, + 128, + 56, + 56, + 136, + 114, + 135, + 115, + 130, + 126, + 134, + 56, + 131, + 137, + 172, + 116, + + 56, + 127, + 129, + 139, + 117, + 118, + 132, + 138, + 133, + 56, + 56, + 56, + 140, + 56, + 141, + 142, + 135, + 56, + 145, + 143, + 134, + 56, + 144, + 137, + 172, + 56, + 56, + 56, + 56, + 139, + 150, + 56, + 56, + 138, + 56, + 56, + 56, + 146, + 140, + 56, + 141, + 142, + 56, + 149, + 145, + 143, + 153, + 159, + 144, + 147, + 148, + 151, + 152, + 56, + 160, + 156, + 150, + 56, + 56, + 154, + 56, + 56, + 155, + 146, + 56, + 56, + 157, + 158, + 162, + 149, + 161, + 56, + 153, + 159, + 164, + 147, + 148, + 151, + 152, + 56, + 160, + 156, + 56, + 56, + 56, + 154, + 168, + 163, + 155, + 56, + 56, + 166, + 157, + 158, + 162, + 165, + 161, + 169, + 56, + 56, + + 164, + 56, + 56, + 173, + 56, + 170, + 56, + 56, + 171, + 56, + 167, + 56, + 168, + 163, + 56, + 177, + 56, + 166, + 56, + 176, + 56, + 165, + 56, + 169, + 174, + 181, + 175, + 183, + 56, + 173, + 178, + 170, + 56, + 179, + 171, + 180, + 167, + 56, + 182, + 56, + 187, + 177, + 189, + 56, + 185, + 176, + 56, + 56, + 184, + 56, + 174, + 181, + 175, + 183, + 188, + 186, + 178, + 56, + 194, + 179, + 56, + 180, + 56, + 191, + 182, + 190, + 187, + 192, + 189, + 56, + 185, + 56, + 195, + 56, + 184, + 56, + 193, + 56, + 197, + 56, + 188, + 186, + 198, + 56, + 194, + 56, + 196, + 56, + 200, + 191, + 56, + 190, + 201, + 192, + 56, + 56, + 205, + 56, + 195, + 199, + + 202, + 56, + 193, + 203, + 197, + 56, + 56, + 207, + 198, + 204, + 208, + 56, + 196, + 56, + 200, + 56, + 56, + 210, + 201, + 206, + 56, + 209, + 205, + 56, + 212, + 199, + 202, + 217, + 56, + 203, + 56, + 215, + 213, + 207, + 211, + 204, + 208, + 56, + 56, + 214, + 56, + 56, + 56, + 210, + 216, + 206, + 218, + 209, + 56, + 219, + 212, + 56, + 56, + 217, + 56, + 56, + 220, + 215, + 213, + 56, + 211, + 56, + 56, + 56, + 56, + 214, + 56, + 56, + 56, + 56, + 216, + 56, + 218, + 56, + 56, + 219, + 56, + 56, + 56, + 95, + 56, + 56, + 220, + 45, + 45, + 47, + 47, + 49, + 49, + 56, + 56, + 95, + 50, + 48, + 56, + 55, + 51, + 50, + 48, + 46, + + 221, + 5, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221}; + +static const flex_int16_t yy_chk[673] = {0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 20, + 25, + 20, + 22, + 22, + 26, + 27, + 28, + 29, + 31, + 226, + 27, + 28, + 32, + 26, + 51, + 28, + 51, + 27, + 25, + 34, + 225, + 32, + 220, + 25, + 27, + 219, + 30, + 27, + 28, + + 218, + 31, + 215, + 214, + 26, + 33, + 29, + 27, + 28, + 34, + 26, + 38, + 28, + 30, + 27, + 25, + 30, + 39, + 32, + 30, + 25, + 27, + 37, + 33, + 27, + 28, + 44, + 31, + 33, + 38, + 26, + 36, + 29, + 38, + 40, + 34, + 39, + 213, + 44, + 30, + 212, + 37, + 30, + 40, + 36, + 30, + 40, + 37, + 41, + 33, + 36, + 43, + 211, + 41, + 33, + 38, + 43, + 41, + 40, + 38, + 42, + 59, + 39, + 40, + 44, + 62, + 58, + 37, + 59, + 40, + 36, + 64, + 40, + 37, + 58, + 60, + 36, + 66, + 42, + 41, + 42, + 62, + 43, + 41, + 40, + 63, + 60, + 65, + 64, + 40, + 63, + 68, + 67, + 209, + 59, + 71, + 65, + 74, + 69, + 80, + + 58, + 66, + 70, + 206, + 42, + 72, + 42, + 62, + 67, + 73, + 68, + 69, + 60, + 74, + 64, + 67, + 63, + 71, + 69, + 77, + 78, + 70, + 65, + 80, + 72, + 79, + 81, + 66, + 73, + 84, + 79, + 205, + 77, + 204, + 67, + 78, + 68, + 69, + 83, + 74, + 86, + 67, + 81, + 71, + 69, + 84, + 83, + 70, + 88, + 80, + 72, + 85, + 90, + 94, + 73, + 75, + 79, + 87, + 77, + 86, + 202, + 78, + 94, + 75, + 89, + 75, + 88, + 85, + 81, + 91, + 89, + 84, + 83, + 75, + 93, + 85, + 87, + 133, + 75, + 75, + 90, + 100, + 91, + 201, + 98, + 86, + 92, + 200, + 94, + 75, + 93, + 75, + 88, + 85, + 92, + 101, + 89, + 98, + 133, + 75, + + 99, + 85, + 87, + 100, + 75, + 75, + 90, + 99, + 91, + 102, + 103, + 105, + 101, + 104, + 102, + 103, + 93, + 106, + 105, + 103, + 92, + 112, + 104, + 98, + 133, + 109, + 107, + 108, + 118, + 100, + 109, + 199, + 198, + 99, + 110, + 111, + 119, + 106, + 101, + 113, + 102, + 103, + 115, + 108, + 105, + 103, + 112, + 118, + 104, + 107, + 107, + 110, + 111, + 114, + 119, + 115, + 109, + 116, + 117, + 113, + 121, + 120, + 114, + 106, + 129, + 124, + 116, + 117, + 121, + 108, + 120, + 123, + 112, + 118, + 124, + 107, + 107, + 110, + 111, + 125, + 119, + 115, + 126, + 128, + 132, + 113, + 129, + 123, + 114, + 131, + 130, + 126, + 116, + 117, + 121, + 125, + 120, + 130, + 134, + 135, + + 124, + 137, + 140, + 134, + 136, + 131, + 141, + 190, + 132, + 144, + 128, + 147, + 129, + 123, + 150, + 140, + 155, + 126, + 157, + 137, + 149, + 125, + 151, + 130, + 135, + 149, + 136, + 151, + 153, + 134, + 141, + 131, + 158, + 144, + 132, + 147, + 128, + 163, + 150, + 156, + 157, + 140, + 163, + 164, + 155, + 137, + 187, + 172, + 153, + 170, + 135, + 149, + 136, + 151, + 158, + 156, + 141, + 165, + 170, + 144, + 166, + 147, + 173, + 165, + 150, + 164, + 157, + 166, + 163, + 174, + 155, + 168, + 172, + 175, + 153, + 177, + 168, + 180, + 174, + 178, + 158, + 156, + 175, + 179, + 170, + 183, + 173, + 186, + 178, + 165, + 181, + 164, + 179, + 166, + 185, + 188, + 186, + 192, + 172, + 177, + + 180, + 189, + 168, + 181, + 174, + 191, + 193, + 189, + 175, + 183, + 191, + 194, + 173, + 203, + 178, + 195, + 197, + 193, + 179, + 188, + 208, + 192, + 186, + 196, + 195, + 177, + 180, + 208, + 207, + 181, + 184, + 203, + 196, + 189, + 194, + 183, + 191, + 210, + 182, + 197, + 216, + 217, + 176, + 193, + 207, + 188, + 210, + 192, + 171, + 216, + 195, + 169, + 167, + 208, + 162, + 161, + 217, + 203, + 196, + 160, + 194, + 159, + 154, + 152, + 148, + 197, + 146, + 145, + 143, + 142, + 207, + 139, + 210, + 138, + 127, + 216, + 122, + 97, + 96, + 95, + 82, + 76, + 217, + 222, + 222, + 223, + 223, + 224, + 224, + 61, + 57, + 52, + 49, + 47, + 35, + 24, + 17, + 11, + 10, + 9, + + 5, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221, + 221}; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -691,8 +2772,8 @@ static const flex_int16_t yy_chk[673] = #line 1 "lex_sql.l" #line 28 "lex_sql.l" -#include -#include +#include +#include /** * flex 代码包含三个部分,使用 %% 分隔 @@ -706,13 +2787,15 @@ static const flex_int16_t yy_chk[673] = #include "yacc_sql.hpp" #ifndef register -#define register -#endif // register +#define register +#endif // register -extern int atoi(); +extern int atoi(); extern double atof(); -#define RETURN_TOKEN(token) LOG_DEBUG("%s", #token);return token +#define RETURN_TOKEN(token) \ + LOG_DEBUG("%s", #token); \ + return token #line 716 "lex_sql.cpp" /* Prevent the need for linking with -lfl */ #define YY_NO_INPUT 1 @@ -741,124 +2824,124 @@ extern double atof(); /* Holds the entire state of the reentrant scanner. */ struct yyguts_t - { +{ + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + 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; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char *yy_last_accepting_cpos; - /* User-defined. Not touched by flex. */ - YY_EXTRA_TYPE yyextra_r; + int yylineno_r; + int yy_flex_debug_r; - /* The rest are the same as the globals declared in the non-reentrant scanner. */ - FILE *yyin_r, *yyout_r; - size_t yy_buffer_stack_top; /**< index of top of stack. */ - 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; - char *yy_c_buf_p; - int yy_init; - int yy_start; - int yy_did_buffer_switch_on_eof; - int yy_start_stack_ptr; - int yy_start_stack_depth; - int *yy_start_stack; - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; + char *yytext_r; + int yy_more_flag; + int yy_more_len; - int yylineno_r; - int yy_flex_debug_r; + YYSTYPE *yylval_r; - char *yytext_r; - int yy_more_flag; - int yy_more_len; + YYLTYPE *yylloc_r; - YYSTYPE * yylval_r; +}; /* end struct yyguts_t */ - YYLTYPE * yylloc_r; +static int yy_init_globals(yyscan_t yyscanner); - }; /* end struct yyguts_t */ +/* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ +#define yylval yyg->yylval_r -static int yy_init_globals ( yyscan_t yyscanner ); +#define yylloc yyg->yylloc_r - /* This must go here because YYSTYPE and YYLTYPE are included - * from bison output in section 1.*/ - # define yylval yyg->yylval_r - - # define yylloc yyg->yylloc_r - -int yylex_init (yyscan_t* scanner); +int yylex_init(yyscan_t *scanner); -int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); +int yylex_init_extra(YY_EXTRA_TYPE user_defined, yyscan_t *scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy ( yyscan_t yyscanner ); +int yylex_destroy(yyscan_t yyscanner); -int yyget_debug ( yyscan_t yyscanner ); +int yyget_debug(yyscan_t yyscanner); -void yyset_debug ( int debug_flag , yyscan_t yyscanner ); +void yyset_debug(int debug_flag, yyscan_t yyscanner); -YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); +YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner); -void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); +void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner); -FILE *yyget_in ( yyscan_t yyscanner ); +FILE *yyget_in(yyscan_t yyscanner); -void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); +void yyset_in(FILE *_in_str, yyscan_t yyscanner); -FILE *yyget_out ( yyscan_t yyscanner ); +FILE *yyget_out(yyscan_t yyscanner); -void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); +void yyset_out(FILE *_out_str, yyscan_t yyscanner); - yy_size_t yyget_leng ( yyscan_t yyscanner ); +yy_size_t yyget_leng(yyscan_t yyscanner); -char *yyget_text ( yyscan_t yyscanner ); +char *yyget_text(yyscan_t yyscanner); -int yyget_lineno ( yyscan_t yyscanner ); +int yyget_lineno(yyscan_t yyscanner); -void yyset_lineno ( int _line_number , yyscan_t yyscanner ); +void yyset_lineno(int _line_number, yyscan_t yyscanner); -int yyget_column ( yyscan_t yyscanner ); +int yyget_column(yyscan_t yyscanner); -void yyset_column ( int _column_no , yyscan_t yyscanner ); +void yyset_column(int _column_no, yyscan_t yyscanner); -YYSTYPE * yyget_lval ( yyscan_t yyscanner ); +YYSTYPE *yyget_lval(yyscan_t yyscanner); -void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); +void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner); + +YYLTYPE *yyget_lloc(yyscan_t yyscanner); + +void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner); - YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); - - void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); - /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap ( yyscan_t yyscanner ); +extern "C" int yywrap(yyscan_t yyscanner); #else -extern int yywrap ( yyscan_t yyscanner ); +extern int yywrap(yyscan_t yyscanner); #endif #endif #ifndef YY_NO_UNPUT - + #endif #ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +static void yy_flex_strncpy(char *, const char *, int, yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * , yyscan_t yyscanner); +static int yy_flex_strlen(const char *, yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput ( yyscan_t yyscanner ); +static int yyinput(yyscan_t yyscanner); #else -static int input ( yyscan_t yyscanner ); +static int input(yyscan_t yyscanner); #endif #endif @@ -878,42 +2961,38 @@ 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 do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#define ECHO \ + do { \ + if (fwrite(yytext, (size_t)yyleng, 1, yyout)) {} \ + } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - yy_size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ +#define YY_INPUT(buf, result, max_size) \ + if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) { \ + int c = '*'; \ + yy_size_t n; \ + for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \ + buf[n] = (char)c; \ + if (c == '\n') \ + buf[n++] = (char)c; \ + if (c == EOF && ferror(yyin)) \ + YY_FATAL_ERROR("input in flex scanner failed"); \ + result = n; \ + } else { \ + errno = 0; \ + while ((result = (int)fread(buf, 1, (yy_size_t)max_size, yyin)) == 0 && ferror(yyin)) { \ + if (errno != EINTR) { \ + YY_FATAL_ERROR("input in flex scanner failed"); \ + break; \ + } \ + errno = 0; \ + clearerr(yyin); \ + } \ + } #endif @@ -932,7 +3011,7 @@ static int input ( yyscan_t yyscanner ); /* Report a fatal error. */ #ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#define YY_FATAL_ERROR(msg) yy_fatal_error(msg, yyscanner) #endif /* end tables serialization structures and prototypes */ @@ -943,11 +3022,9 @@ static int input ( yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int yylex \ - (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); +extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner); -#define YY_DECL int yylex \ - (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#define YY_DECL int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng @@ -959,624 +3036,538 @@ extern int yylex \ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; +#define YY_BREAK /*LINTED*/ break; #endif -#define YY_RULE_SETUP \ - YY_USER_ACTION +#define YY_RULE_SETUP YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; - yylval = yylval_param; + yylval = yylval_param; - yylloc = yylloc_param; + yylloc = yylloc_param; - if ( !yyg->yy_init ) - { - yyg->yy_init = 1; + if (!yyg->yy_init) { + yyg->yy_init = 1; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yyg->yy_start ) - yyg->yy_start = 1; /* first start state */ + if (!yyg->yy_start) + yyg->yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if (!yyin) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if (!yyout) + yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (yyscanner); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); - } + if (!YY_CURRENT_BUFFER) { + yyensure_buffer_stack(yyscanner); + YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); + } - yy_load_buffer_state( yyscanner ); - } + yy_load_buffer_state(yyscanner); + } - { + { #line 75 "lex_sql.l" - #line 1011 "lex_sql.cpp" - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ - { - yy_cp = yyg->yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yyg->yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yyg->yy_start; -yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 222 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 602 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yyg->yy_hold_char; - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; - goto yy_find_action; - -case 1: -YY_RULE_SETUP + while (/*CONSTCOND*/ 1) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; + yy_match: + do { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if (yy_accept[yy_current_state]) { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { + yy_current_state = (int)yy_def[yy_current_state]; + if (yy_current_state >= 222) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } while (yy_base[yy_current_state] != 602); + + yy_find_action: + yy_act = yy_accept[yy_current_state]; + if (yy_act == 0) { /* have to back up */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + do_action: /* This label is used only to access EOF actions. */ + + switch (yy_act) { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + + case 1: YY_RULE_SETUP #line 77 "lex_sql.l" -// ignore whitespace - YY_BREAK -case 2: -/* rule 2 can match eol */ -YY_RULE_SETUP + // ignore whitespace + YY_BREAK + case 2: + /* rule 2 can match eol */ + YY_RULE_SETUP #line 78 "lex_sql.l" -; - YY_BREAK -case 3: -YY_RULE_SETUP + ; + YY_BREAK + case 3: YY_RULE_SETUP #line 80 "lex_sql.l" -yylval->number=atoi(yytext); RETURN_TOKEN(NUMBER); - YY_BREAK -case 4: -YY_RULE_SETUP + yylval->number = atoi(yytext); + RETURN_TOKEN(NUMBER); + YY_BREAK + case 4: YY_RULE_SETUP #line 81 "lex_sql.l" -yylval->floats=(float)(atof(yytext)); RETURN_TOKEN(FLOAT); - YY_BREAK -case 5: -YY_RULE_SETUP + yylval->floats = (float)(atof(yytext)); + RETURN_TOKEN(FLOAT); + YY_BREAK + case 5: YY_RULE_SETUP #line 83 "lex_sql.l" -RETURN_TOKEN(SEMICOLON); - YY_BREAK -case 6: -YY_RULE_SETUP + RETURN_TOKEN(SEMICOLON); + YY_BREAK + case 6: YY_RULE_SETUP #line 84 "lex_sql.l" -RETURN_TOKEN(DOT); - YY_BREAK -case 7: -YY_RULE_SETUP + RETURN_TOKEN(DOT); + YY_BREAK + case 7: YY_RULE_SETUP #line 85 "lex_sql.l" -RETURN_TOKEN(EXIT); - YY_BREAK -case 8: -YY_RULE_SETUP + RETURN_TOKEN(EXIT); + YY_BREAK + case 8: YY_RULE_SETUP #line 86 "lex_sql.l" -RETURN_TOKEN(HELP); - YY_BREAK -case 9: -YY_RULE_SETUP + RETURN_TOKEN(HELP); + YY_BREAK + case 9: YY_RULE_SETUP #line 87 "lex_sql.l" -RETURN_TOKEN(DESC); - YY_BREAK -case 10: -YY_RULE_SETUP + RETURN_TOKEN(DESC); + YY_BREAK + case 10: YY_RULE_SETUP #line 88 "lex_sql.l" -RETURN_TOKEN(CREATE); - YY_BREAK -case 11: -YY_RULE_SETUP + RETURN_TOKEN(CREATE); + YY_BREAK + case 11: YY_RULE_SETUP #line 89 "lex_sql.l" -RETURN_TOKEN(DROP); - YY_BREAK -case 12: -YY_RULE_SETUP + RETURN_TOKEN(DROP); + YY_BREAK + case 12: YY_RULE_SETUP #line 90 "lex_sql.l" -RETURN_TOKEN(TABLE); - YY_BREAK -case 13: -YY_RULE_SETUP + RETURN_TOKEN(TABLE); + YY_BREAK + case 13: YY_RULE_SETUP #line 91 "lex_sql.l" -RETURN_TOKEN(TABLES); - YY_BREAK -case 14: -YY_RULE_SETUP + RETURN_TOKEN(TABLES); + YY_BREAK + case 14: YY_RULE_SETUP #line 92 "lex_sql.l" -RETURN_TOKEN(INDEX); - YY_BREAK -case 15: -YY_RULE_SETUP + RETURN_TOKEN(INDEX); + YY_BREAK + case 15: YY_RULE_SETUP #line 93 "lex_sql.l" -RETURN_TOKEN(ON); - YY_BREAK -case 16: -YY_RULE_SETUP + RETURN_TOKEN(ON); + YY_BREAK + case 16: YY_RULE_SETUP #line 94 "lex_sql.l" -RETURN_TOKEN(SHOW); - YY_BREAK -case 17: -YY_RULE_SETUP + RETURN_TOKEN(SHOW); + YY_BREAK + case 17: YY_RULE_SETUP #line 95 "lex_sql.l" -RETURN_TOKEN(SYNC); - YY_BREAK -case 18: -YY_RULE_SETUP + RETURN_TOKEN(SYNC); + YY_BREAK + case 18: YY_RULE_SETUP #line 96 "lex_sql.l" -RETURN_TOKEN(SELECT); - YY_BREAK -case 19: -YY_RULE_SETUP + RETURN_TOKEN(SELECT); + YY_BREAK + case 19: YY_RULE_SETUP #line 97 "lex_sql.l" -RETURN_TOKEN(CALC); - YY_BREAK -case 20: -YY_RULE_SETUP + RETURN_TOKEN(CALC); + YY_BREAK + case 20: YY_RULE_SETUP #line 98 "lex_sql.l" -RETURN_TOKEN(FROM); - YY_BREAK -case 21: -YY_RULE_SETUP + RETURN_TOKEN(FROM); + YY_BREAK + case 21: YY_RULE_SETUP #line 99 "lex_sql.l" -RETURN_TOKEN(WHERE); - YY_BREAK -case 22: -YY_RULE_SETUP + RETURN_TOKEN(WHERE); + YY_BREAK + case 22: YY_RULE_SETUP #line 100 "lex_sql.l" -RETURN_TOKEN(AND); - YY_BREAK -case 23: -YY_RULE_SETUP + RETURN_TOKEN(AND); + YY_BREAK + case 23: YY_RULE_SETUP #line 101 "lex_sql.l" -RETURN_TOKEN(OR); - YY_BREAK -case 24: -YY_RULE_SETUP + RETURN_TOKEN(OR); + YY_BREAK + case 24: YY_RULE_SETUP #line 102 "lex_sql.l" -RETURN_TOKEN(INSERT); - YY_BREAK -case 25: -YY_RULE_SETUP + RETURN_TOKEN(INSERT); + YY_BREAK + case 25: YY_RULE_SETUP #line 103 "lex_sql.l" -RETURN_TOKEN(INTO); - YY_BREAK -case 26: -YY_RULE_SETUP + RETURN_TOKEN(INTO); + YY_BREAK + case 26: YY_RULE_SETUP #line 104 "lex_sql.l" -RETURN_TOKEN(VALUES); - YY_BREAK -case 27: -YY_RULE_SETUP + RETURN_TOKEN(VALUES); + YY_BREAK + case 27: YY_RULE_SETUP #line 105 "lex_sql.l" -RETURN_TOKEN(DELETE); - YY_BREAK -case 28: -YY_RULE_SETUP + RETURN_TOKEN(DELETE); + YY_BREAK + case 28: YY_RULE_SETUP #line 106 "lex_sql.l" -RETURN_TOKEN(UPDATE); - YY_BREAK -case 29: -YY_RULE_SETUP + RETURN_TOKEN(UPDATE); + YY_BREAK + case 29: YY_RULE_SETUP #line 107 "lex_sql.l" -RETURN_TOKEN(SET); - YY_BREAK -case 30: -YY_RULE_SETUP + RETURN_TOKEN(SET); + YY_BREAK + case 30: YY_RULE_SETUP #line 108 "lex_sql.l" -RETURN_TOKEN(TRX_BEGIN); - YY_BREAK -case 31: -YY_RULE_SETUP + RETURN_TOKEN(TRX_BEGIN); + YY_BREAK + case 31: YY_RULE_SETUP #line 109 "lex_sql.l" -RETURN_TOKEN(TRX_COMMIT); - YY_BREAK -case 32: -YY_RULE_SETUP + RETURN_TOKEN(TRX_COMMIT); + YY_BREAK + case 32: YY_RULE_SETUP #line 110 "lex_sql.l" -RETURN_TOKEN(TRX_ROLLBACK); - YY_BREAK -case 33: -YY_RULE_SETUP + RETURN_TOKEN(TRX_ROLLBACK); + YY_BREAK + case 33: YY_RULE_SETUP #line 111 "lex_sql.l" -RETURN_TOKEN(INT_T); - YY_BREAK -case 34: -YY_RULE_SETUP + RETURN_TOKEN(INT_T); + YY_BREAK + case 34: YY_RULE_SETUP #line 112 "lex_sql.l" -RETURN_TOKEN(STRING_T); - YY_BREAK -case 35: -YY_RULE_SETUP + RETURN_TOKEN(STRING_T); + YY_BREAK + case 35: YY_RULE_SETUP #line 113 "lex_sql.l" -RETURN_TOKEN(FLOAT_T); - YY_BREAK -case 36: -YY_RULE_SETUP + RETURN_TOKEN(FLOAT_T); + YY_BREAK + case 36: YY_RULE_SETUP #line 114 "lex_sql.l" -RETURN_TOKEN(DATE_T); // 增加 DATE 的 token - YY_BREAK -case 37: -YY_RULE_SETUP + RETURN_TOKEN(DATE_T); // 增加 DATE 的 token + YY_BREAK + case 37: YY_RULE_SETUP #line 115 "lex_sql.l" -RETURN_TOKEN(TEXT_T); // 增加 TEXT 的 token - YY_BREAK -case 38: -YY_RULE_SETUP + RETURN_TOKEN(TEXT_T); // 增加 TEXT 的 token + YY_BREAK + case 38: YY_RULE_SETUP #line 116 "lex_sql.l" -RETURN_TOKEN(UNIQUE); - YY_BREAK -case 39: -YY_RULE_SETUP + RETURN_TOKEN(UNIQUE); + YY_BREAK + case 39: YY_RULE_SETUP #line 117 "lex_sql.l" -RETURN_TOKEN(NULL_T); - YY_BREAK -case 40: -YY_RULE_SETUP + RETURN_TOKEN(NULL_T); + YY_BREAK + case 40: YY_RULE_SETUP #line 118 "lex_sql.l" -RETURN_TOKEN(NULLABLE); - YY_BREAK -case 41: -YY_RULE_SETUP + RETURN_TOKEN(NULLABLE); + YY_BREAK + case 41: YY_RULE_SETUP #line 119 "lex_sql.l" -RETURN_TOKEN(LOAD); - YY_BREAK -case 42: -YY_RULE_SETUP + RETURN_TOKEN(LOAD); + YY_BREAK + case 42: YY_RULE_SETUP #line 120 "lex_sql.l" -RETURN_TOKEN(DATA); - YY_BREAK -case 43: -YY_RULE_SETUP + RETURN_TOKEN(DATA); + YY_BREAK + case 43: YY_RULE_SETUP #line 121 "lex_sql.l" -RETURN_TOKEN(INFILE); - YY_BREAK -case 44: -YY_RULE_SETUP + RETURN_TOKEN(INFILE); + YY_BREAK + case 44: YY_RULE_SETUP #line 122 "lex_sql.l" -RETURN_TOKEN(EXPLAIN); - YY_BREAK -case 45: -YY_RULE_SETUP + RETURN_TOKEN(EXPLAIN); + YY_BREAK + case 45: YY_RULE_SETUP #line 123 "lex_sql.l" -RETURN_TOKEN(GROUP); - YY_BREAK -case 46: -YY_RULE_SETUP + RETURN_TOKEN(GROUP); + YY_BREAK + case 46: YY_RULE_SETUP #line 124 "lex_sql.l" -RETURN_TOKEN(ORDER); - YY_BREAK -case 47: -YY_RULE_SETUP + RETURN_TOKEN(ORDER); + YY_BREAK + case 47: YY_RULE_SETUP #line 125 "lex_sql.l" -RETURN_TOKEN(BY); - YY_BREAK -case 48: -YY_RULE_SETUP + RETURN_TOKEN(BY); + YY_BREAK + case 48: YY_RULE_SETUP #line 126 "lex_sql.l" -RETURN_TOKEN(AS); - YY_BREAK -case 49: -YY_RULE_SETUP + RETURN_TOKEN(AS); + YY_BREAK + case 49: YY_RULE_SETUP #line 127 "lex_sql.l" -RETURN_TOKEN(ASC); - YY_BREAK -case 50: -YY_RULE_SETUP + RETURN_TOKEN(ASC); + YY_BREAK + case 50: YY_RULE_SETUP #line 128 "lex_sql.l" -RETURN_TOKEN(IN); - YY_BREAK -case 51: -YY_RULE_SETUP + RETURN_TOKEN(IN); + YY_BREAK + case 51: YY_RULE_SETUP #line 129 "lex_sql.l" -RETURN_TOKEN(EXISTS); - YY_BREAK -case 52: -YY_RULE_SETUP + RETURN_TOKEN(EXISTS); + YY_BREAK + case 52: YY_RULE_SETUP #line 130 "lex_sql.l" -RETURN_TOKEN(STORAGE); - YY_BREAK -case 53: -YY_RULE_SETUP + RETURN_TOKEN(STORAGE); + YY_BREAK + case 53: YY_RULE_SETUP #line 131 "lex_sql.l" -RETURN_TOKEN(FORMAT); - YY_BREAK -case 54: -YY_RULE_SETUP + RETURN_TOKEN(FORMAT); + YY_BREAK + case 54: YY_RULE_SETUP #line 132 "lex_sql.l" -RETURN_TOKEN(INNER); - YY_BREAK -case 55: -YY_RULE_SETUP + RETURN_TOKEN(INNER); + YY_BREAK + case 55: YY_RULE_SETUP #line 133 "lex_sql.l" -RETURN_TOKEN(JOIN); - YY_BREAK -case 56: -YY_RULE_SETUP + RETURN_TOKEN(JOIN); + YY_BREAK + case 56: YY_RULE_SETUP #line 134 "lex_sql.l" -RETURN_TOKEN(LBRACE); - YY_BREAK -case 57: -YY_RULE_SETUP + RETURN_TOKEN(LBRACE); + YY_BREAK + case 57: YY_RULE_SETUP #line 135 "lex_sql.l" -RETURN_TOKEN(RBRACE); - YY_BREAK -case 58: -YY_RULE_SETUP + RETURN_TOKEN(RBRACE); + YY_BREAK + case 58: YY_RULE_SETUP #line 137 "lex_sql.l" -RETURN_TOKEN(COMMA); - YY_BREAK -case 59: -YY_RULE_SETUP + RETURN_TOKEN(COMMA); + YY_BREAK + case 59: YY_RULE_SETUP #line 138 "lex_sql.l" -RETURN_TOKEN(EQ); - YY_BREAK -case 60: -YY_RULE_SETUP + RETURN_TOKEN(EQ); + YY_BREAK + case 60: YY_RULE_SETUP #line 139 "lex_sql.l" -RETURN_TOKEN(LE); - YY_BREAK -case 61: -YY_RULE_SETUP + RETURN_TOKEN(LE); + YY_BREAK + case 61: YY_RULE_SETUP #line 140 "lex_sql.l" -RETURN_TOKEN(NE); - YY_BREAK -case 62: -YY_RULE_SETUP + RETURN_TOKEN(NE); + YY_BREAK + case 62: YY_RULE_SETUP #line 141 "lex_sql.l" -RETURN_TOKEN(NE); - YY_BREAK -case 63: -YY_RULE_SETUP + RETURN_TOKEN(NE); + YY_BREAK + case 63: YY_RULE_SETUP #line 142 "lex_sql.l" -RETURN_TOKEN(LT); - YY_BREAK -case 64: -YY_RULE_SETUP + RETURN_TOKEN(LT); + YY_BREAK + case 64: YY_RULE_SETUP #line 143 "lex_sql.l" -RETURN_TOKEN(GE); - YY_BREAK -case 65: -YY_RULE_SETUP + RETURN_TOKEN(GE); + YY_BREAK + case 65: YY_RULE_SETUP #line 144 "lex_sql.l" -RETURN_TOKEN(GT); - YY_BREAK -case 66: -YY_RULE_SETUP + RETURN_TOKEN(GT); + YY_BREAK + case 66: YY_RULE_SETUP #line 145 "lex_sql.l" -RETURN_TOKEN(NOT); - YY_BREAK -case 67: -YY_RULE_SETUP + RETURN_TOKEN(NOT); + YY_BREAK + case 67: YY_RULE_SETUP #line 146 "lex_sql.l" -RETURN_TOKEN(IS); - YY_BREAK -case 68: -YY_RULE_SETUP + RETURN_TOKEN(IS); + YY_BREAK + case 68: YY_RULE_SETUP #line 147 "lex_sql.l" -RETURN_TOKEN(LIKE); - YY_BREAK -case 69: -YY_RULE_SETUP + RETURN_TOKEN(LIKE); + YY_BREAK + case 69: YY_RULE_SETUP #line 149 "lex_sql.l" -yylval->string=strdup(yytext); RETURN_TOKEN(ID); - YY_BREAK -case 70: + yylval->string = strdup(yytext); + RETURN_TOKEN(ID); + YY_BREAK + case 70: #line 152 "lex_sql.l" -case 71: + case 71: #line 153 "lex_sql.l" -case 72: + case 72: #line 154 "lex_sql.l" -case 73: -YY_RULE_SETUP + case 73: YY_RULE_SETUP #line 154 "lex_sql.l" -{ return yytext[0]; } - YY_BREAK -case 74: -/* rule 74 can match eol */ -YY_RULE_SETUP + { + return yytext[0]; + } + YY_BREAK + case 74: + /* rule 74 can match eol */ + YY_RULE_SETUP #line 155 "lex_sql.l" -yylval->string = strdup(yytext); RETURN_TOKEN(SSS); - YY_BREAK -case 75: -/* rule 75 can match eol */ -YY_RULE_SETUP + yylval->string = strdup(yytext); + RETURN_TOKEN(SSS); + YY_BREAK + case 75: + /* rule 75 can match eol */ + YY_RULE_SETUP #line 156 "lex_sql.l" -yylval->string = strdup(yytext); RETURN_TOKEN(SSS); - YY_BREAK -case 76: -YY_RULE_SETUP + yylval->string = strdup(yytext); + RETURN_TOKEN(SSS); + YY_BREAK + case 76: YY_RULE_SETUP #line 158 "lex_sql.l" -LOG_DEBUG("Unknown character [%c]",yytext[0]); return yytext[0]; - YY_BREAK -case 77: -YY_RULE_SETUP + LOG_DEBUG("Unknown character [%c]",yytext[0]); + return yytext[0]; + YY_BREAK + case 77: YY_RULE_SETUP #line 159 "lex_sql.l" -ECHO; - YY_BREAK + ECHO; + YY_BREAK #line 1447 "lex_sql.cpp" -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(STR): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yyg->yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( yyscanner ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); - - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yyg->yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yyg->yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( yyscanner ) ) - { - case EOB_ACT_END_OF_FILE: - { - yyg->yy_did_buffer_switch_on_eof = 0; - - if ( yywrap( yyscanner ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yyg->yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yyg->yy_c_buf_p = - yyg->yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( yyscanner ); - - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yyg->yy_c_buf_p = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; - - yy_current_state = yy_get_previous_state( yyscanner ); - - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(STR): yyterminate(); + + case YY_END_OF_BUFFER: { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int)(yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if (yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]) { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(yyscanner); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans(yy_current_state, yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if (yy_next_state) { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else + switch (yy_get_next_buffer(yyscanner)) { + case EOB_ACT_END_OF_FILE: { + yyg->yy_did_buffer_switch_on_eof = 0; + + if (yywrap(yyscanner)) { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else { + if (!yyg->yy_did_buffer_switch_on_eof) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(yyscanner); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state(yyscanner); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1586,171 +3577,149 @@ case YY_STATE_EOF(STR): * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ -static int yy_get_next_buffer (yyscan_t yyscanner) +static int yy_get_next_buffer(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = yyg->yytext_ptr; - int number_to_move, i; - int ret_val; - - if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) (yyg->yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - if ( yyg->yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin , yyscanner); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( - (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); - } - - yyg->yy_n_chars += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + int number_to_move, i; + int ret_val; + + if (yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1]) + YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed"); + + if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) { /* Don't try to fill the buffer, so this is an EOF. */ + if (yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1) { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int)(yyg->yy_c_buf_p - yyg->yytext_ptr - 1); + + for (i = 0; i < number_to_move; ++i) + *(dest++) = *(source++); + + if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else { + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = (int)(yyg->yy_c_buf_p - b->yy_ch_buf); + + if (b->yy_is_our_buffer) { + yy_size_t new_size = b->yy_buf_size * 2; + + if (new_size <= 0) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *)b->yy_ch_buf, (yy_size_t)(b->yy_buf_size + 2), yyscanner); + } else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if (!b->yy_ch_buf) + YY_FATAL_ERROR("fatal error - scanner input buffer overflow"); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + } + + if (num_to_read > YY_READ_BUF_SIZE) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), yyg->yy_n_chars, num_to_read); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if (yyg->yy_n_chars == 0) { + if (number_to_move == YY_MORE_ADJ) { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin, yyscanner); + } + + else { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = + (char *)yyrealloc((void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t)new_size, yyscanner); + if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) + YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()"); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int)(new_size - 2); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ - static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +static yy_state_type yy_get_previous_state(yyscan_t yyscanner) { - yy_state_type yy_current_state; - char *yy_cp; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - yy_current_state = yyg->yy_start; - - for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 222 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - } - - return yy_current_state; + yy_state_type yy_current_state; + char *yy_cp; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + + yy_current_state = yyg->yy_start; + + for (yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp) { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if (yy_accept[yy_current_state]) { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { + yy_current_state = (int)yy_def[yy_current_state]; + if (yy_current_state >= 222) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character @@ -1758,29 +3727,27 @@ static int yy_get_next_buffer (yyscan_t yyscanner) * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state, yyscan_t yyscanner) { - int yy_is_jam; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - char *yy_cp = yyg->yy_c_buf_p; - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yyg->yy_last_accepting_state = yy_current_state; - yyg->yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 222 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 221); - - (void)yyg; - return yy_is_jam ? 0 : yy_current_state; + int yy_is_jam; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; /* This var may be unused depending upon options. */ + char *yy_cp = yyg->yy_c_buf_p; + + YY_CHAR yy_c = 1; + if (yy_accept[yy_current_state]) { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { + yy_current_state = (int)yy_def[yy_current_state]; + if (yy_current_state >= 222) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 221); + + (void)yyg; + return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT @@ -1789,141 +3756,133 @@ static int yy_get_next_buffer (yyscan_t yyscanner) #ifndef YY_NO_INPUT #ifdef __cplusplus - static int yyinput (yyscan_t yyscanner) +static int yyinput(yyscan_t yyscanner) #else - static int input (yyscan_t yyscanner) +static int input(yyscan_t yyscanner) #endif { - int c; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - *yyg->yy_c_buf_p = yyg->yy_hold_char; - - if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) - /* This was really a NUL. */ - *yyg->yy_c_buf_p = '\0'; - - else - { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; - ++yyg->yy_c_buf_p; - - switch ( yy_get_next_buffer( yyscanner ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin , yyscanner); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( yyscanner ) ) - return 0; - - if ( ! yyg->yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + int c; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if (*yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR) { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if (yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else { /* need more input */ + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch (yy_get_next_buffer(yyscanner)) { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin, yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: { + if (yywrap(yyscanner)) + return 0; + + if (!yyg->yy_did_buffer_switch_on_eof) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(yyscanner); + return yyinput(yyscanner); #else - return input(yyscanner); + return input(yyscanner); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - yyg->yy_c_buf_p = yyg->yytext_ptr + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: yyg->yy_c_buf_p = yyg->yytext_ptr + offset; break; + } + } + } - c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ - *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ - yyg->yy_hold_char = *++yyg->yy_c_buf_p; + c = *(unsigned char *)yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ - void yyrestart (FILE * input_file , yyscan_t yyscanner) +void yyrestart(FILE *input_file, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (yyscanner); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); - } + if (!YY_CURRENT_BUFFER) { + yyensure_buffer_stack(yyscanner); + YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); + } - yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); - yy_load_buffer_state( yyscanner ); + yy_init_buffer(YY_CURRENT_BUFFER, input_file, yyscanner); + yy_load_buffer_state(yyscanner); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (yyscanner); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *yyg->yy_c_buf_p = yyg->yy_hold_char; - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( yyscanner ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yyg->yy_did_buffer_switch_on_eof = 1; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack(yyscanner); + if (YY_CURRENT_BUFFER == new_buffer) + return; + + if (YY_CURRENT_BUFFER) { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state(yyscanner); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; } -static void yy_load_buffer_state (yyscan_t yyscanner) +static void yy_load_buffer_state(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - yyg->yy_hold_char = *yyg->yy_c_buf_p; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; } /** Allocate and initialize an input buffer state. @@ -1932,105 +3891,105 @@ static void yy_load_buffer_state (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the allocated buffer state. */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner) { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner); + if (!b) + YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); - b->yy_buf_size = size; + b->yy_buf_size = size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *)yyalloc((yy_size_t)(b->yy_buf_size + 2), yyscanner); + if (!b->yy_ch_buf) + YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - yy_init_buffer( b, file , yyscanner); + yy_init_buffer(b, file, yyscanner); - return b; + return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * @param yyscanner The scanner object. */ - void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; - if ( ! b ) - return; + if (!b) + return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0; - if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf , yyscanner ); + if (b->yy_is_our_buffer) + yyfree((void *)b->yy_ch_buf, yyscanner); - yyfree( (void *) b , yyscanner ); + yyfree((void *)b, yyscanner); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) +static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner) { - int oerrno = errno; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + int oerrno = errno; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; - yy_flush_buffer( b , yyscanner); + yy_flush_buffer(b, yyscanner); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER) { + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0; - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * @param yyscanner The scanner object. */ - void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if ( ! b ) - return; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + if (!b) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( yyscanner ); + if (b == YY_CURRENT_BUFFER) + yy_load_buffer_state(yyscanner); } /** Pushes the new state onto the stack. The new state becomes @@ -2039,99 +3998,95 @@ static void yy_load_buffer_state (yyscan_t yyscanner) * @param new_buffer The new state. * @param yyscanner The scanner object. */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(yyscanner); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *yyg->yy_c_buf_p = yyg->yy_hold_char; - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - yyg->yy_buffer_stack_top++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( yyscanner ); - yyg->yy_did_buffer_switch_on_eof = 1; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + if (YY_CURRENT_BUFFER) { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state(yyscanner); + yyg->yy_did_buffer_switch_on_eof = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * @param yyscanner The scanner object. */ -void yypop_buffer_state (yyscan_t yyscanner) +void yypop_buffer_state(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); - YY_CURRENT_BUFFER_LVALUE = NULL; - if (yyg->yy_buffer_stack_top > 0) - --yyg->yy_buffer_stack_top; - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( yyscanner ); - yyg->yy_did_buffer_switch_on_eof = 1; - } + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state(yyscanner); + yyg->yy_did_buffer_switch_on_eof = 1; + } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void yyensure_buffer_stack (yyscan_t yyscanner) +static void yyensure_buffer_stack(yyscan_t yyscanner) { - yy_size_t num_to_alloc; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - if (!yyg->yy_buffer_stack) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - , yyscanner); - if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - yyg->yy_buffer_stack_max = num_to_alloc; - yyg->yy_buffer_stack_top = 0; - return; - } - - if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = yyg->yy_buffer_stack_max + grow_size; - yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc - (yyg->yy_buffer_stack, - num_to_alloc * sizeof(struct yy_buffer_state*) - , yyscanner); - if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); - yyg->yy_buffer_stack_max = num_to_alloc; - } + yy_size_t num_to_alloc; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + yyg->yy_buffer_stack = + (struct yy_buffer_state **)yyalloc(num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner); + if (!yyg->yy_buffer_stack) + YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state *)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1) { + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state **)yyrealloc( + yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner); + if (!yyg->yy_buffer_stack) + YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()"); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state *)); + yyg->yy_buffer_stack_max = num_to_alloc; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. @@ -2140,33 +4095,31 @@ static void yyensure_buffer_stack (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner) { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return NULL; - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = NULL; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b , yyscanner ); - - return b; + YY_BUFFER_STATE b; + + if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || base[size - 1] != YY_END_OF_BUFFER_CHAR) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner); + if (!b) + YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()"); + + b->yy_buf_size = (int)(size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b, yyscanner); + + return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will @@ -2177,10 +4130,10 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_string(const char *yystr, yyscan_t yyscanner) { - - return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); + + return yy_scan_bytes(yystr, (int)strlen(yystr), yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will @@ -2190,177 +4143,175 @@ YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_bytes(const char *yybytes, yy_size_t _yybytes_len, yyscan_t yyscanner) { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n , yyscanner ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n , yyscanner); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t)(_yybytes_len + 2); + buf = (char *)yyalloc(n, yyscanner); + if (!buf) + YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()"); + + for (i = 0; i < _yybytes_len; ++i) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf, n, yyscanner); + if (!b) + YY_FATAL_ERROR("bad buffer in yy_scan_bytes()"); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) +static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + (void)yyg; + fprintf(stderr, "%s\n", msg); + exit(YY_EXIT_FAILURE); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yy_size_t yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = yyg->yy_hold_char; \ - yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ - yyg->yy_hold_char = *yyg->yy_c_buf_p; \ - *yyg->yy_c_buf_p = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) +#define yyless(n) \ + do { \ + /* Undo effects of setting up yytext. */ \ + yy_size_t yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg); \ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } while (0) /* Accessor methods (get/set functions) to struct members. */ /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ -YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yyextra; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + return yyextra; } /** Get the current line number. * @param yyscanner The scanner object. */ -int yyget_lineno (yyscan_t yyscanner) +int yyget_lineno(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; - if (! YY_CURRENT_BUFFER) - return 0; - - return yylineno; + if (!YY_CURRENT_BUFFER) + return 0; + + return yylineno; } /** Get the current column number. * @param yyscanner The scanner object. */ -int yyget_column (yyscan_t yyscanner) +int yyget_column(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; - if (! YY_CURRENT_BUFFER) - return 0; - - return yycolumn; + if (!YY_CURRENT_BUFFER) + return 0; + + return yycolumn; } /** Get the input stream. * @param yyscanner The scanner object. */ -FILE *yyget_in (yyscan_t yyscanner) +FILE *yyget_in(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yyin; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + return yyin; } /** Get the output stream. * @param yyscanner The scanner object. */ -FILE *yyget_out (yyscan_t yyscanner) +FILE *yyget_out(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yyout; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + return yyout; } /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t yyget_leng (yyscan_t yyscanner) +yy_size_t yyget_leng(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yyleng; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + return yyleng; } /** Get the current token. * @param yyscanner The scanner object. */ -char *yyget_text (yyscan_t yyscanner) +char *yyget_text(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yytext; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + return yytext; } /** Set the user-defined data. This data is never touched by the scanner. * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. */ -void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyextra = user_defined ; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + yyextra = user_defined; } /** Set the current line number. * @param _line_number line number * @param yyscanner The scanner object. */ -void yyset_lineno (int _line_number , yyscan_t yyscanner) +void yyset_lineno(int _line_number, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; - /* lineno is only valid if an input buffer exists. */ - if (! YY_CURRENT_BUFFER ) - YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); - - yylineno = _line_number; + /* lineno is only valid if an input buffer exists. */ + if (!YY_CURRENT_BUFFER) + YY_FATAL_ERROR("yyset_lineno called with no buffer"); + + yylineno = _line_number; } /** Set the current column. * @param _column_no column number * @param yyscanner The scanner object. */ -void yyset_column (int _column_no , yyscan_t yyscanner) +void yyset_column(int _column_no, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (!YY_CURRENT_BUFFER) + YY_FATAL_ERROR("yyset_column called with no buffer"); - /* column is only valid if an input buffer exists. */ - if (! YY_CURRENT_BUFFER ) - YY_FATAL_ERROR( "yyset_column called with no buffer" ); - - yycolumn = _column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current @@ -2369,80 +4320,80 @@ void yyset_column (int _column_no , yyscan_t yyscanner) * @param yyscanner The scanner object. * @see yy_switch_to_buffer */ -void yyset_in (FILE * _in_str , yyscan_t yyscanner) +void yyset_in(FILE *_in_str, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = _in_str ; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + yyin = _in_str; } -void yyset_out (FILE * _out_str , yyscan_t yyscanner) +void yyset_out(FILE *_out_str, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = _out_str ; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + yyout = _out_str; } -int yyget_debug (yyscan_t yyscanner) +int yyget_debug(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yy_flex_debug; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + return yy_flex_debug; } -void yyset_debug (int _bdebug , yyscan_t yyscanner) +void yyset_debug(int _bdebug, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = _bdebug ; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + yy_flex_debug = _bdebug; } /* Accessor methods for yylval and yylloc */ -YYSTYPE * yyget_lval (yyscan_t yyscanner) +YYSTYPE *yyget_lval(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yylval; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + return yylval; } -void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yylval = yylval_param; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + yylval = yylval_param; } -YYLTYPE *yyget_lloc (yyscan_t yyscanner) +YYLTYPE *yyget_lloc(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - return yylloc; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + return yylloc; } - -void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) + +void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yylloc = yylloc_param; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + yylloc = yylloc_param; } - + /* User-visible API */ /* yylex_init is special because it creates the scanner itself, so it is * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ -int yylex_init(yyscan_t* ptr_yy_globals) +int yylex_init(yyscan_t *ptr_yy_globals) { - if (ptr_yy_globals == NULL){ - errno = EINVAL; - return 1; - } + if (ptr_yy_globals == NULL) { + errno = EINVAL; + return 1; + } - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), NULL); - if (*ptr_yy_globals == NULL){ - errno = ENOMEM; - return 1; - } + if (*ptr_yy_globals == NULL) { + errno = ENOMEM; + return 1; + } - /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ - memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t)); - return yy_init_globals ( *ptr_yy_globals ); + return yy_init_globals(*ptr_yy_globals); } /* yylex_init_extra has the same functionality as yylex_init, but follows the @@ -2452,94 +4403,94 @@ int yylex_init(yyscan_t* ptr_yy_globals) * The user defined value in the first argument will be available to yyalloc in * the yyextra field. */ -int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) +int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined, yyscan_t *ptr_yy_globals) { - struct yyguts_t dummy_yyguts; + struct yyguts_t dummy_yyguts; - yyset_extra (yy_user_defined, &dummy_yyguts); + yyset_extra(yy_user_defined, &dummy_yyguts); - if (ptr_yy_globals == NULL){ - errno = EINVAL; - return 1; - } + if (ptr_yy_globals == NULL) { + errno = EINVAL; + return 1; + } - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), &dummy_yyguts); - if (*ptr_yy_globals == NULL){ - errno = ENOMEM; - return 1; - } + if (*ptr_yy_globals == NULL) { + errno = ENOMEM; + return 1; + } - /* By setting to 0xAA, we expose bugs in - yy_init_globals. Leave at 0x00 for releases. */ - memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t)); - yyset_extra (yy_user_defined, *ptr_yy_globals); + yyset_extra(yy_user_defined, *ptr_yy_globals); - return yy_init_globals ( *ptr_yy_globals ); + return yy_init_globals(*ptr_yy_globals); } -static int yy_init_globals (yyscan_t yyscanner) +static int yy_init_globals(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - yyg->yy_buffer_stack = NULL; - yyg->yy_buffer_stack_top = 0; - yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = NULL; - yyg->yy_init = 0; - yyg->yy_start = 0; - - yyg->yy_start_stack_ptr = 0; - yyg->yy_start_stack_depth = 0; - yyg->yy_start_stack = NULL; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = NULL; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = NULL; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; /* Defined in main.c */ #ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; + yyin = stdin; + yyout = stdout; #else - yyin = NULL; - yyout = NULL; + yyin = NULL; + yyout = NULL; #endif - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (yyscan_t yyscanner) +int yylex_destroy(yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(yyscanner); - } - - /* Destroy the stack itself. */ - yyfree(yyg->yy_buffer_stack , yyscanner); - yyg->yy_buffer_stack = NULL; - - /* Destroy the start condition stack. */ - yyfree( yyg->yy_start_stack , yyscanner ); - yyg->yy_start_stack = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( yyscanner); - - /* Destroy the main struct (reentrant only). */ - yyfree ( yyscanner , yyscanner ); - yyscanner = NULL; - return 0; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while (YY_CURRENT_BUFFER) { + yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack, yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree(yyg->yy_start_stack, yyscanner); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals(yyscanner); + + /* Destroy the main struct (reentrant only). */ + yyfree(yyscanner, yyscanner); + yyscanner = NULL; + return 0; } /* @@ -2547,63 +4498,59 @@ int yylex_destroy (yyscan_t yyscanner) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) +static void yy_flex_strncpy(char *s1, const char *s2, int n, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + (void)yyg; - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; + int i; + for (i = 0; i < n; ++i) + s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (const char * s , yyscan_t yyscanner) +static int yy_flex_strlen(const char *s, yyscan_t yyscanner) { - int n; - for ( n = 0; s[n]; ++n ) - ; + int n; + for (n = 0; s[n]; ++n) + ; - return n; + return n; } #endif -void *yyalloc (yy_size_t size , yyscan_t yyscanner) +void *yyalloc(yy_size_t size, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - return malloc(size); + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + (void)yyg; + return malloc(size); } -void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +void *yyrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return realloc(ptr, size); + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + (void)yyg; + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); } -void yyfree (void * ptr , yyscan_t yyscanner) +void yyfree(void *ptr, yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; + (void)yyg; + free((char *)ptr); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 159 "lex_sql.l" - -void scan_string(const char *str, yyscan_t scanner) { - yy_switch_to_buffer(yy_scan_string(str, scanner), scanner); -} - +void scan_string(const char *str, yyscan_t scanner) { yy_switch_to_buffer(yy_scan_string(str, scanner), scanner); } diff --git a/src/observer/sql/parser/lex_sql.h b/src/observer/sql/parser/lex_sql.h index d9d6fa07..48c24424 100644 --- a/src/observer/sql/parser/lex_sql.h +++ b/src/observer/sql/parser/lex_sql.h @@ -12,23 +12,21 @@ typedef int yy_size_t; /* 参考生成的lex_sql.cpp代码,这个宏定义会放在每次运行yylex()最开始的地方 */ -#define YY_USER_INIT \ - yycolumn = 0; +#define YY_USER_INIT yycolumn = 0; /* 参考生成的lex_sql.cpp代码,这个宏定义会放在解析一个token之后,也可以在网上找到大量的参考资料 */ /* 我们在这里设置当前解析的token的位置信息,这样在yacc中就可以使用这些信息了 */ -#define YY_USER_ACTION \ -do { \ - yylloc->first_line = yylloc->last_line = yylineno; \ - yylloc->first_column = yycolumn; \ - yylloc->last_column = yylloc->first_column + yyleng - 1; \ - yycolumn += yyleng; \ -} \ -while (0); +#define YY_USER_ACTION \ + do { \ + yylloc->first_line = yylloc->last_line = yylineno; \ + yylloc->first_column = yycolumn; \ + yylloc->last_column = yylloc->first_column + yyleng - 1; \ + yycolumn += yyleng; \ + } while (0); #line 29 "lex_sql.h" -#define YY_INT_ALIGNED short int +#define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ @@ -81,62 +79,62 @@ while (0); /* C99 systems have . Non-C99 systems may or may not. */ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. + * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; +typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; typedef uint64_t flex_uint64_t; #else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; +typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN -#define INT8_MIN (-128) +#define INT8_MIN (-128) #endif #ifndef INT16_MIN -#define INT16_MIN (-32767-1) +#define INT16_MIN (-32767 - 1) #endif #ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) +#define INT32_MIN (-2147483647 - 1) #endif #ifndef INT8_MAX -#define INT8_MAX (127) +#define INT8_MAX (127) #endif #ifndef INT16_MAX -#define INT16_MAX (32767) +#define INT16_MAX (32767) #endif #ifndef INT32_MAX -#define INT32_MAX (2147483647) +#define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX -#define UINT8_MAX (255U) +#define UINT8_MAX (255U) #endif #ifndef UINT16_MAX -#define UINT16_MAX (65535U) +#define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) +#define UINT32_MAX (4294967295U) #endif #ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) +#define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ @@ -157,7 +155,7 @@ typedef unsigned int flex_uint32_t; /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T -typedef void* yyscan_t; +typedef void *yyscan_t; #endif /* For convenience, these vars (plus the bison vars far below) @@ -197,73 +195,72 @@ typedef size_t yy_size_t; #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - int yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t 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 - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - - }; +{ + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t 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 + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +}; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ -void yyrestart ( FILE *input_file , yyscan_t yyscanner ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); -void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); -void yypop_buffer_state ( yyscan_t yyscanner ); +void yyrestart(FILE *input_file, yyscan_t yyscanner); +void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); +YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner); +void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner); +void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner); +void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner); +void yypop_buffer_state(yyscan_t yyscanner); -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner); +YY_BUFFER_STATE yy_scan_string(const char *yy_str, yyscan_t yyscanner); +YY_BUFFER_STATE yy_scan_bytes(const char *bytes, yy_size_t len, yyscan_t yyscanner); -void *yyalloc ( yy_size_t , yyscan_t yyscanner ); -void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); -void yyfree ( void * , yyscan_t yyscanner ); +void *yyalloc(yy_size_t, yyscan_t yyscanner); +void *yyrealloc(void *, yy_size_t, yyscan_t yyscanner); +void yyfree(void *, yyscan_t yyscanner); /* Begin user sect3 */ -#define yywrap(yyscanner) (/*CONSTCOND*/1) +#define yywrap(yyscanner) (/*CONSTCOND*/ 1) #define YY_SKIP_YYWRAP #define yytext_ptr yytext_r @@ -286,69 +283,69 @@ void yyfree ( void * , yyscan_t yyscanner ); #define YY_EXTRA_TYPE void * #endif -int yylex_init (yyscan_t* scanner); +int yylex_init(yyscan_t *scanner); -int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); +int yylex_init_extra(YY_EXTRA_TYPE user_defined, yyscan_t *scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy ( yyscan_t yyscanner ); +int yylex_destroy(yyscan_t yyscanner); -int yyget_debug ( yyscan_t yyscanner ); +int yyget_debug(yyscan_t yyscanner); -void yyset_debug ( int debug_flag , yyscan_t yyscanner ); +void yyset_debug(int debug_flag, yyscan_t yyscanner); -YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); +YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner); -void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); +void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner); -FILE *yyget_in ( yyscan_t yyscanner ); +FILE *yyget_in(yyscan_t yyscanner); -void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); +void yyset_in(FILE *_in_str, yyscan_t yyscanner); -FILE *yyget_out ( yyscan_t yyscanner ); +FILE *yyget_out(yyscan_t yyscanner); -void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); +void yyset_out(FILE *_out_str, yyscan_t yyscanner); - yy_size_t yyget_leng ( yyscan_t yyscanner ); +yy_size_t yyget_leng(yyscan_t yyscanner); -char *yyget_text ( yyscan_t yyscanner ); +char *yyget_text(yyscan_t yyscanner); -int yyget_lineno ( yyscan_t yyscanner ); +int yyget_lineno(yyscan_t yyscanner); -void yyset_lineno ( int _line_number , yyscan_t yyscanner ); +void yyset_lineno(int _line_number, yyscan_t yyscanner); -int yyget_column ( yyscan_t yyscanner ); +int yyget_column(yyscan_t yyscanner); -void yyset_column ( int _column_no , yyscan_t yyscanner ); +void yyset_column(int _column_no, yyscan_t yyscanner); -YYSTYPE * yyget_lval ( yyscan_t yyscanner ); +YYSTYPE *yyget_lval(yyscan_t yyscanner); -void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); +void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner); + +YYLTYPE *yyget_lloc(yyscan_t yyscanner); + +void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner); - YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); - - void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); - /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap ( yyscan_t yyscanner ); +extern "C" int yywrap(yyscan_t yyscanner); #else -extern int yywrap ( yyscan_t yyscanner ); +extern int yywrap(yyscan_t yyscanner); #endif #endif #ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +static void yy_flex_strncpy(char *, const char *, int, yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * , yyscan_t yyscanner); +static int yy_flex_strlen(const char *, yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT @@ -376,11 +373,9 @@ static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int yylex \ - (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); +extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner); -#define YY_DECL int yylex \ - (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#define YY_DECL int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner) #endif /* !YY_DECL */ /* yy_get_previous_state - get the state just before the EOB char was reached */ @@ -544,7 +539,6 @@ extern int yylex \ #line 159 "lex_sql.l" - #line 548 "lex_sql.h" #undef yyIN_HEADER #endif /* yyHEADER_H */ diff --git a/src/observer/sql/parser/yacc_sql.cpp b/src/observer/sql/parser/yacc_sql.cpp index 77b8714a..6f24dd67 100644 --- a/src/observer/sql/parser/yacc_sql.cpp +++ b/src/observer/sql/parser/yacc_sql.cpp @@ -63,13 +63,9 @@ /* Pull parsers. */ #define YYPULL 1 - - - /* First part of user prologue. */ #line 2 "yacc_sql.y" - #include #include #include @@ -92,200 +88,191 @@ string token_name(const char *sql_string, YYLTYPE *llocp) int yyerror(YYLTYPE *llocp, const char *sql_string, ParsedSqlResult *sql_result, yyscan_t scanner, const char *msg) { std::unique_ptr error_sql_node = std::make_unique(SCF_ERROR); - error_sql_node->error.error_msg = msg; - error_sql_node->error.line = llocp->first_line; - error_sql_node->error.column = llocp->first_column; + error_sql_node->error.error_msg = msg; + error_sql_node->error.line = llocp->first_line; + error_sql_node->error.column = llocp->first_column; sql_result->add_sql_node(std::move(error_sql_node)); return 0; } -ArithmeticExpr *create_arithmetic_expression(ArithmeticExpr::Type type, - Expression *left, - Expression *right, - const char *sql_string, - YYLTYPE *llocp) +ArithmeticExpr *create_arithmetic_expression( + ArithmeticExpr::Type type, Expression *left, Expression *right, const char *sql_string, YYLTYPE *llocp) { ArithmeticExpr *expr = new ArithmeticExpr(type, left, right); expr->set_name(token_name(sql_string, llocp)); return expr; } -UnboundFunctionExpr *create_aggregate_expression(const char *function_name, - std::vector> child, - const char *sql_string, - YYLTYPE *llocp) +UnboundFunctionExpr *create_aggregate_expression( + const char *function_name, std::vector> child, const char *sql_string, YYLTYPE *llocp) { UnboundFunctionExpr *expr = new UnboundFunctionExpr(function_name, std::move(child)); expr->set_name(token_name(sql_string, llocp)); return expr; } - #line 125 "yacc_sql.cpp" -# ifndef YY_CAST -# ifdef __cplusplus -# define YY_CAST(Type, Val) static_cast (Val) -# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) -# else -# define YY_CAST(Type, Val) ((Type) (Val)) -# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) -# endif -# endif -# ifndef YY_NULLPTR -# if defined __cplusplus -# if 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# else -# define YY_NULLPTR ((void*)0) -# endif -# endif +#ifndef YY_CAST +#ifdef __cplusplus +#define YY_CAST(Type, Val) static_cast(Val) +#define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast(Val) +#else +#define YY_CAST(Type, Val) ((Type)(Val)) +#define YY_REINTERPRET_CAST(Type, Val) ((Type)(Val)) +#endif +#endif +#ifndef YY_NULLPTR +#if defined __cplusplus +#if 201103L <= __cplusplus +#define YY_NULLPTR nullptr +#else +#define YY_NULLPTR 0 +#endif +#else +#define YY_NULLPTR ((void *)0) +#endif +#endif #include "yacc_sql.hpp" /* Symbol kind. */ enum yysymbol_kind_t { - YYSYMBOL_YYEMPTY = -2, - YYSYMBOL_YYEOF = 0, /* "end of file" */ - YYSYMBOL_YYerror = 1, /* error */ - YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ - YYSYMBOL_SEMICOLON = 3, /* SEMICOLON */ - YYSYMBOL_AS = 4, /* AS */ - YYSYMBOL_ASC = 5, /* ASC */ - YYSYMBOL_BY = 6, /* BY */ - YYSYMBOL_CREATE = 7, /* CREATE */ - YYSYMBOL_DROP = 8, /* DROP */ - YYSYMBOL_EXISTS = 9, /* EXISTS */ - YYSYMBOL_GROUP = 10, /* GROUP */ - YYSYMBOL_ORDER = 11, /* ORDER */ - YYSYMBOL_TABLE = 12, /* TABLE */ - YYSYMBOL_TABLES = 13, /* TABLES */ - YYSYMBOL_INDEX = 14, /* INDEX */ - YYSYMBOL_CALC = 15, /* CALC */ - YYSYMBOL_SELECT = 16, /* SELECT */ - YYSYMBOL_DESC = 17, /* DESC */ - YYSYMBOL_SHOW = 18, /* SHOW */ - YYSYMBOL_SYNC = 19, /* SYNC */ - YYSYMBOL_INSERT = 20, /* INSERT */ - YYSYMBOL_DELETE = 21, /* DELETE */ - YYSYMBOL_UPDATE = 22, /* UPDATE */ - YYSYMBOL_LBRACE = 23, /* LBRACE */ - YYSYMBOL_RBRACE = 24, /* RBRACE */ - YYSYMBOL_COMMA = 25, /* COMMA */ - YYSYMBOL_TRX_BEGIN = 26, /* TRX_BEGIN */ - YYSYMBOL_TRX_COMMIT = 27, /* TRX_COMMIT */ - YYSYMBOL_TRX_ROLLBACK = 28, /* TRX_ROLLBACK */ - YYSYMBOL_INT_T = 29, /* INT_T */ - YYSYMBOL_IN = 30, /* IN */ - YYSYMBOL_STRING_T = 31, /* STRING_T */ - YYSYMBOL_FLOAT_T = 32, /* FLOAT_T */ - YYSYMBOL_DATE_T = 33, /* DATE_T */ - YYSYMBOL_TEXT_T = 34, /* TEXT_T */ - YYSYMBOL_NOT = 35, /* NOT */ - YYSYMBOL_UNIQUE = 36, /* UNIQUE */ - YYSYMBOL_NULL_T = 37, /* NULL_T */ - YYSYMBOL_NULLABLE = 38, /* NULLABLE */ - YYSYMBOL_HELP = 39, /* HELP */ - YYSYMBOL_EXIT = 40, /* EXIT */ - YYSYMBOL_DOT = 41, /* DOT */ - YYSYMBOL_INTO = 42, /* INTO */ - YYSYMBOL_VALUES = 43, /* VALUES */ - YYSYMBOL_FROM = 44, /* FROM */ - YYSYMBOL_WHERE = 45, /* WHERE */ - YYSYMBOL_AND = 46, /* AND */ - YYSYMBOL_OR = 47, /* OR */ - YYSYMBOL_SET = 48, /* SET */ - YYSYMBOL_ON = 49, /* ON */ - YYSYMBOL_LOAD = 50, /* LOAD */ - YYSYMBOL_DATA = 51, /* DATA */ - YYSYMBOL_INFILE = 52, /* INFILE */ - YYSYMBOL_EXPLAIN = 53, /* EXPLAIN */ - YYSYMBOL_STORAGE = 54, /* STORAGE */ - YYSYMBOL_FORMAT = 55, /* FORMAT */ - YYSYMBOL_INNER = 56, /* INNER */ - YYSYMBOL_JOIN = 57, /* JOIN */ - YYSYMBOL_EQ = 58, /* EQ */ - YYSYMBOL_LT = 59, /* LT */ - YYSYMBOL_GT = 60, /* GT */ - YYSYMBOL_LE = 61, /* LE */ - YYSYMBOL_GE = 62, /* GE */ - YYSYMBOL_NE = 63, /* NE */ - YYSYMBOL_LIKE = 64, /* LIKE */ - YYSYMBOL_IS = 65, /* IS */ - YYSYMBOL_NUMBER = 66, /* NUMBER */ - YYSYMBOL_FLOAT = 67, /* FLOAT */ - YYSYMBOL_ID = 68, /* ID */ - YYSYMBOL_SSS = 69, /* SSS */ - YYSYMBOL_70_ = 70, /* '+' */ - YYSYMBOL_71_ = 71, /* '-' */ - YYSYMBOL_72_ = 72, /* '*' */ - YYSYMBOL_73_ = 73, /* '/' */ - YYSYMBOL_UMINUS = 74, /* UMINUS */ - YYSYMBOL_YYACCEPT = 75, /* $accept */ - YYSYMBOL_commands = 76, /* commands */ - YYSYMBOL_command_wrapper = 77, /* command_wrapper */ - YYSYMBOL_exit_stmt = 78, /* exit_stmt */ - YYSYMBOL_help_stmt = 79, /* help_stmt */ - YYSYMBOL_sync_stmt = 80, /* sync_stmt */ - YYSYMBOL_begin_stmt = 81, /* begin_stmt */ - YYSYMBOL_commit_stmt = 82, /* commit_stmt */ - YYSYMBOL_rollback_stmt = 83, /* rollback_stmt */ - YYSYMBOL_drop_table_stmt = 84, /* drop_table_stmt */ - YYSYMBOL_show_tables_stmt = 85, /* show_tables_stmt */ - YYSYMBOL_desc_table_stmt = 86, /* desc_table_stmt */ - YYSYMBOL_show_index_stmt = 87, /* show_index_stmt */ - YYSYMBOL_create_index_stmt = 88, /* create_index_stmt */ - YYSYMBOL_opt_unique = 89, /* opt_unique */ - YYSYMBOL_attr_list = 90, /* attr_list */ - YYSYMBOL_drop_index_stmt = 91, /* drop_index_stmt */ - YYSYMBOL_create_table_stmt = 92, /* create_table_stmt */ - YYSYMBOL_attr_def_list = 93, /* attr_def_list */ - YYSYMBOL_attr_def = 94, /* attr_def */ - YYSYMBOL_nullable_constraint = 95, /* nullable_constraint */ - YYSYMBOL_number = 96, /* number */ - YYSYMBOL_type = 97, /* type */ - YYSYMBOL_insert_stmt = 98, /* insert_stmt */ - YYSYMBOL_values_list = 99, /* values_list */ - YYSYMBOL_value_list = 100, /* value_list */ - YYSYMBOL_value = 101, /* value */ - YYSYMBOL_storage_format = 102, /* storage_format */ - YYSYMBOL_delete_stmt = 103, /* delete_stmt */ - YYSYMBOL_update_stmt = 104, /* update_stmt */ - YYSYMBOL_setClauses = 105, /* setClauses */ - YYSYMBOL_setClause = 106, /* setClause */ - YYSYMBOL_select_stmt = 107, /* select_stmt */ - YYSYMBOL_calc_stmt = 108, /* calc_stmt */ - YYSYMBOL_expression_list = 109, /* expression_list */ - YYSYMBOL_expression = 110, /* expression */ - YYSYMBOL_alias = 111, /* alias */ - YYSYMBOL_aggr_func_expr = 112, /* aggr_func_expr */ - YYSYMBOL_sub_query_expr = 113, /* sub_query_expr */ - YYSYMBOL_rel_attr = 114, /* rel_attr */ - YYSYMBOL_relation = 115, /* relation */ - YYSYMBOL_rel_list = 116, /* rel_list */ - YYSYMBOL_joinClauses = 117, /* joinClauses */ - YYSYMBOL_where = 118, /* where */ - YYSYMBOL_condition = 119, /* condition */ - YYSYMBOL_comp_op = 120, /* comp_op */ - YYSYMBOL_opt_order_by = 121, /* opt_order_by */ - YYSYMBOL_sort_list = 122, /* sort_list */ - YYSYMBOL_sort_unit = 123, /* sort_unit */ - YYSYMBOL_group_by = 124, /* group_by */ - YYSYMBOL_load_data_stmt = 125, /* load_data_stmt */ - YYSYMBOL_explain_stmt = 126, /* explain_stmt */ - YYSYMBOL_set_variable_stmt = 127, /* set_variable_stmt */ - YYSYMBOL_opt_semicolon = 128 /* opt_semicolon */ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_SEMICOLON = 3, /* SEMICOLON */ + YYSYMBOL_AS = 4, /* AS */ + YYSYMBOL_ASC = 5, /* ASC */ + YYSYMBOL_BY = 6, /* BY */ + YYSYMBOL_CREATE = 7, /* CREATE */ + YYSYMBOL_DROP = 8, /* DROP */ + YYSYMBOL_EXISTS = 9, /* EXISTS */ + YYSYMBOL_GROUP = 10, /* GROUP */ + YYSYMBOL_ORDER = 11, /* ORDER */ + YYSYMBOL_TABLE = 12, /* TABLE */ + YYSYMBOL_TABLES = 13, /* TABLES */ + YYSYMBOL_INDEX = 14, /* INDEX */ + YYSYMBOL_CALC = 15, /* CALC */ + YYSYMBOL_SELECT = 16, /* SELECT */ + YYSYMBOL_DESC = 17, /* DESC */ + YYSYMBOL_SHOW = 18, /* SHOW */ + YYSYMBOL_SYNC = 19, /* SYNC */ + YYSYMBOL_INSERT = 20, /* INSERT */ + YYSYMBOL_DELETE = 21, /* DELETE */ + YYSYMBOL_UPDATE = 22, /* UPDATE */ + YYSYMBOL_LBRACE = 23, /* LBRACE */ + YYSYMBOL_RBRACE = 24, /* RBRACE */ + YYSYMBOL_COMMA = 25, /* COMMA */ + YYSYMBOL_TRX_BEGIN = 26, /* TRX_BEGIN */ + YYSYMBOL_TRX_COMMIT = 27, /* TRX_COMMIT */ + YYSYMBOL_TRX_ROLLBACK = 28, /* TRX_ROLLBACK */ + YYSYMBOL_INT_T = 29, /* INT_T */ + YYSYMBOL_IN = 30, /* IN */ + YYSYMBOL_STRING_T = 31, /* STRING_T */ + YYSYMBOL_FLOAT_T = 32, /* FLOAT_T */ + YYSYMBOL_DATE_T = 33, /* DATE_T */ + YYSYMBOL_TEXT_T = 34, /* TEXT_T */ + YYSYMBOL_NOT = 35, /* NOT */ + YYSYMBOL_UNIQUE = 36, /* UNIQUE */ + YYSYMBOL_NULL_T = 37, /* NULL_T */ + YYSYMBOL_NULLABLE = 38, /* NULLABLE */ + YYSYMBOL_HELP = 39, /* HELP */ + YYSYMBOL_EXIT = 40, /* EXIT */ + YYSYMBOL_DOT = 41, /* DOT */ + YYSYMBOL_INTO = 42, /* INTO */ + YYSYMBOL_VALUES = 43, /* VALUES */ + YYSYMBOL_FROM = 44, /* FROM */ + YYSYMBOL_WHERE = 45, /* WHERE */ + YYSYMBOL_AND = 46, /* AND */ + YYSYMBOL_OR = 47, /* OR */ + YYSYMBOL_SET = 48, /* SET */ + YYSYMBOL_ON = 49, /* ON */ + YYSYMBOL_LOAD = 50, /* LOAD */ + YYSYMBOL_DATA = 51, /* DATA */ + YYSYMBOL_INFILE = 52, /* INFILE */ + YYSYMBOL_EXPLAIN = 53, /* EXPLAIN */ + YYSYMBOL_STORAGE = 54, /* STORAGE */ + YYSYMBOL_FORMAT = 55, /* FORMAT */ + YYSYMBOL_INNER = 56, /* INNER */ + YYSYMBOL_JOIN = 57, /* JOIN */ + YYSYMBOL_EQ = 58, /* EQ */ + YYSYMBOL_LT = 59, /* LT */ + YYSYMBOL_GT = 60, /* GT */ + YYSYMBOL_LE = 61, /* LE */ + YYSYMBOL_GE = 62, /* GE */ + YYSYMBOL_NE = 63, /* NE */ + YYSYMBOL_LIKE = 64, /* LIKE */ + YYSYMBOL_IS = 65, /* IS */ + YYSYMBOL_NUMBER = 66, /* NUMBER */ + YYSYMBOL_FLOAT = 67, /* FLOAT */ + YYSYMBOL_ID = 68, /* ID */ + YYSYMBOL_SSS = 69, /* SSS */ + YYSYMBOL_70_ = 70, /* '+' */ + YYSYMBOL_71_ = 71, /* '-' */ + YYSYMBOL_72_ = 72, /* '*' */ + YYSYMBOL_73_ = 73, /* '/' */ + YYSYMBOL_UMINUS = 74, /* UMINUS */ + YYSYMBOL_YYACCEPT = 75, /* $accept */ + YYSYMBOL_commands = 76, /* commands */ + YYSYMBOL_command_wrapper = 77, /* command_wrapper */ + YYSYMBOL_exit_stmt = 78, /* exit_stmt */ + YYSYMBOL_help_stmt = 79, /* help_stmt */ + YYSYMBOL_sync_stmt = 80, /* sync_stmt */ + YYSYMBOL_begin_stmt = 81, /* begin_stmt */ + YYSYMBOL_commit_stmt = 82, /* commit_stmt */ + YYSYMBOL_rollback_stmt = 83, /* rollback_stmt */ + YYSYMBOL_drop_table_stmt = 84, /* drop_table_stmt */ + YYSYMBOL_show_tables_stmt = 85, /* show_tables_stmt */ + YYSYMBOL_desc_table_stmt = 86, /* desc_table_stmt */ + YYSYMBOL_show_index_stmt = 87, /* show_index_stmt */ + YYSYMBOL_create_index_stmt = 88, /* create_index_stmt */ + YYSYMBOL_opt_unique = 89, /* opt_unique */ + YYSYMBOL_attr_list = 90, /* attr_list */ + YYSYMBOL_drop_index_stmt = 91, /* drop_index_stmt */ + YYSYMBOL_create_table_stmt = 92, /* create_table_stmt */ + YYSYMBOL_attr_def_list = 93, /* attr_def_list */ + YYSYMBOL_attr_def = 94, /* attr_def */ + YYSYMBOL_nullable_constraint = 95, /* nullable_constraint */ + YYSYMBOL_number = 96, /* number */ + YYSYMBOL_type = 97, /* type */ + YYSYMBOL_insert_stmt = 98, /* insert_stmt */ + YYSYMBOL_values_list = 99, /* values_list */ + YYSYMBOL_value_list = 100, /* value_list */ + YYSYMBOL_value = 101, /* value */ + YYSYMBOL_storage_format = 102, /* storage_format */ + YYSYMBOL_delete_stmt = 103, /* delete_stmt */ + YYSYMBOL_update_stmt = 104, /* update_stmt */ + YYSYMBOL_setClauses = 105, /* setClauses */ + YYSYMBOL_setClause = 106, /* setClause */ + YYSYMBOL_select_stmt = 107, /* select_stmt */ + YYSYMBOL_calc_stmt = 108, /* calc_stmt */ + YYSYMBOL_expression_list = 109, /* expression_list */ + YYSYMBOL_expression = 110, /* expression */ + YYSYMBOL_alias = 111, /* alias */ + YYSYMBOL_aggr_func_expr = 112, /* aggr_func_expr */ + YYSYMBOL_sub_query_expr = 113, /* sub_query_expr */ + YYSYMBOL_rel_attr = 114, /* rel_attr */ + YYSYMBOL_relation = 115, /* relation */ + YYSYMBOL_rel_list = 116, /* rel_list */ + YYSYMBOL_joinClauses = 117, /* joinClauses */ + YYSYMBOL_where = 118, /* where */ + YYSYMBOL_condition = 119, /* condition */ + YYSYMBOL_comp_op = 120, /* comp_op */ + YYSYMBOL_opt_order_by = 121, /* opt_order_by */ + YYSYMBOL_sort_list = 122, /* sort_list */ + YYSYMBOL_sort_unit = 123, /* sort_unit */ + YYSYMBOL_group_by = 124, /* group_by */ + YYSYMBOL_load_data_stmt = 125, /* load_data_stmt */ + YYSYMBOL_explain_stmt = 126, /* explain_stmt */ + YYSYMBOL_set_variable_stmt = 127, /* set_variable_stmt */ + YYSYMBOL_opt_semicolon = 128 /* opt_semicolon */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; - - - #ifdef short -# undef short +#undef short #endif /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure @@ -293,11 +280,11 @@ typedef enum yysymbol_kind_t yysymbol_kind_t; so that the code can choose integer types of a good width. */ #ifndef __PTRDIFF_MAX__ -# include /* INFRINGES ON USER NAME SPACE */ -# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_STDINT_H -# endif +#include /* INFRINGES ON USER NAME SPACE */ +#if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +#include /* INFRINGES ON USER NAME SPACE */ +#define YY_STDINT_H +#endif #endif /* Narrow types that promote to a signed type and that can represent a @@ -327,16 +314,15 @@ typedef short yytype_int16; (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of . */ #ifdef __hpux -# undef UINT_LEAST8_MAX -# undef UINT_LEAST16_MAX -# define UINT_LEAST8_MAX 255 -# define UINT_LEAST16_MAX 65535 +#undef UINT_LEAST8_MAX +#undef UINT_LEAST16_MAX +#define UINT_LEAST8_MAX 255 +#define UINT_LEAST16_MAX 65535 #endif #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; -#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST8_MAX <= INT_MAX) +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H && UINT_LEAST8_MAX <= INT_MAX) typedef uint_least8_t yytype_uint8; #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX typedef unsigned char yytype_uint8; @@ -346,8 +332,7 @@ typedef short yytype_uint8; #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ typedef __UINT_LEAST16_TYPE__ yytype_uint16; -#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ - && UINT_LEAST16_MAX <= INT_MAX) +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H && UINT_LEAST16_MAX <= INT_MAX) typedef uint_least16_t yytype_uint16; #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX typedef unsigned short yytype_uint16; @@ -356,42 +341,38 @@ typedef int yytype_uint16; #endif #ifndef YYPTRDIFF_T -# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ -# define YYPTRDIFF_T __PTRDIFF_TYPE__ -# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ -# elif defined PTRDIFF_MAX -# ifndef ptrdiff_t -# include /* INFRINGES ON USER NAME SPACE */ -# endif -# define YYPTRDIFF_T ptrdiff_t -# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX -# else -# define YYPTRDIFF_T long -# define YYPTRDIFF_MAXIMUM LONG_MAX -# endif +#if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +#define YYPTRDIFF_T __PTRDIFF_TYPE__ +#define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +#elif defined PTRDIFF_MAX +#ifndef ptrdiff_t +#include /* INFRINGES ON USER NAME SPACE */ +#endif +#define YYPTRDIFF_T ptrdiff_t +#define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +#else +#define YYPTRDIFF_T long +#define YYPTRDIFF_MAXIMUM LONG_MAX +#endif #endif #ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned -# endif +#ifdef __SIZE_TYPE__ +#define YYSIZE_T __SIZE_TYPE__ +#elif defined size_t +#define YYSIZE_T size_t +#elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +#include /* INFRINGES ON USER NAME SPACE */ +#define YYSIZE_T size_t +#else +#define YYSIZE_T unsigned +#endif #endif -#define YYSIZE_MAXIMUM \ - YY_CAST (YYPTRDIFF_T, \ - (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ - ? YYPTRDIFF_MAXIMUM \ - : YY_CAST (YYSIZE_T, -1))) - -#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) +#define YYSIZE_MAXIMUM \ + YY_CAST(YYPTRDIFF_T, (YYPTRDIFF_MAXIMUM < YY_CAST(YYSIZE_T, -1) ? YYPTRDIFF_MAXIMUM : YY_CAST(YYSIZE_T, -1))) +#define YYSIZEOF(X) YY_CAST(YYPTRDIFF_T, sizeof(X)) /* Stored state numbers (used for stacks). */ typedef yytype_uint8 yy_state_t; @@ -400,586 +381,2397 @@ typedef yytype_uint8 yy_state_t; typedef int yy_state_fast_t; #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif +#if defined YYENABLE_NLS && YYENABLE_NLS +#if ENABLE_NLS +#include /* INFRINGES ON USER NAME SPACE */ +#define YY_(Msgid) dgettext("bison-runtime", Msgid) +#endif +#endif +#ifndef YY_ +#define YY_(Msgid) Msgid +#endif #endif - #ifndef YY_ATTRIBUTE_PURE -# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) -# else -# define YY_ATTRIBUTE_PURE -# endif +#if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +#define YY_ATTRIBUTE_PURE __attribute__((__pure__)) +#else +#define YY_ATTRIBUTE_PURE +#endif #endif #ifndef YY_ATTRIBUTE_UNUSED -# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) -# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -# else -# define YY_ATTRIBUTE_UNUSED -# endif +#if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +#define YY_ATTRIBUTE_UNUSED __attribute__((__unused__)) +#else +#define YY_ATTRIBUTE_UNUSED +#endif #endif /* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YY_USE(E) ((void) (E)) +#if !defined lint || defined __GNUC__ +#define YY_USE(E) ((void)(E)) #else -# define YY_USE(E) /* empty */ +#define YY_USE(E) /* empty */ #endif /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ -# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") -# else -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# endif -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") +#if defined __GNUC__ && !defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") +#else +#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +#endif +#define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop") #else -# define YY_INITIAL_VALUE(Value) Value +#define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +#define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif -#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ -# define YY_IGNORE_USELESS_CAST_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") -# define YY_IGNORE_USELESS_CAST_END \ - _Pragma ("GCC diagnostic pop") +#if defined __cplusplus && defined __GNUC__ && !defined __ICC && 6 <= __GNUC__ +#define YY_IGNORE_USELESS_CAST_BEGIN _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"") +#define YY_IGNORE_USELESS_CAST_END _Pragma("GCC diagnostic pop") #endif #ifndef YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_BEGIN -# define YY_IGNORE_USELESS_CAST_END +#define YY_IGNORE_USELESS_CAST_BEGIN +#define YY_IGNORE_USELESS_CAST_END #endif - -#define YY_ASSERT(E) ((void) (0 && (E))) +#define YY_ASSERT(E) ((void)(0 && (E))) #if 1 /* The parser invokes alloca or malloc; define the necessary symbols. */ -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif +#ifdef YYSTACK_USE_ALLOCA +#if YYSTACK_USE_ALLOCA +#ifdef __GNUC__ +#define YYSTACK_ALLOC __builtin_alloca +#elif defined __BUILTIN_VA_ARG_INCR +#include /* INFRINGES ON USER NAME SPACE */ +#elif defined _AIX +#define YYSTACK_ALLOC __alloca +#elif defined _MSC_VER +#include /* INFRINGES ON USER NAME SPACE */ +#define alloca _alloca +#else +#define YYSTACK_ALLOC alloca +#if !defined _ALLOCA_H && !defined EXIT_SUCCESS +#include /* INFRINGES ON USER NAME SPACE */ +/* Use EXIT_SUCCESS as a witness for stdlib.h. */ +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif +#endif +#endif +#endif +#endif + +#ifdef YYSTACK_ALLOC +/* Pacify GCC's 'empty if-body' warning. */ +#define YYSTACK_FREE(Ptr) \ + do { /* empty */ \ + ; \ + } while (0) +#ifndef YYSTACK_ALLOC_MAXIMUM +/* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +#define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +#endif +#else +#define YYSTACK_ALLOC YYMALLOC +#define YYSTACK_FREE YYFREE +#ifndef YYSTACK_ALLOC_MAXIMUM +#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +#endif +#if (defined __cplusplus && !defined EXIT_SUCCESS && \ + !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free))) +#include /* INFRINGES ON USER NAME SPACE */ +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif +#endif +#ifndef YYMALLOC +#define YYMALLOC malloc +#if !defined malloc && !defined EXIT_SUCCESS +void *malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +#endif +#endif +#ifndef YYFREE +#define YYFREE free +#if !defined free && !defined EXIT_SUCCESS +void free(void *); /* INFRINGES ON USER NAME SPACE */ +#endif +#endif +#endif #endif /* 1 */ -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ - && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) +#if (!defined yyoverflow && (!defined __cplusplus || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL && \ + defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yy_state_t yyss_alloc; - YYSTYPE yyvs_alloc; - YYLTYPE yyls_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) +#define YYSTACK_GAP_MAXIMUM (YYSIZEOF(union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \ - + YYSIZEOF (YYLTYPE)) \ - + 2 * YYSTACK_GAP_MAXIMUM) +#define YYSTACK_BYTES(N) \ + ((N) * (YYSIZEOF(yy_state_t) + YYSIZEOF(YYSTYPE) + YYSIZEOF(YYLTYPE)) + 2 * YYSTACK_GAP_MAXIMUM) -# define YYCOPY_NEEDED 1 +#define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYPTRDIFF_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / YYSIZEOF (*yyptr); \ - } \ - while (0) +#define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do { \ + YYPTRDIFF_T yynewbytes; \ + YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * YYSIZEOF(*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF(*yyptr); \ + } while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYPTRDIFF_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif +#ifndef YYCOPY +#if defined __GNUC__ && 1 < __GNUC__ +#define YYCOPY(Dst, Src, Count) __builtin_memcpy(Dst, Src, YY_CAST(YYSIZE_T, (Count)) * sizeof(*(Src))) +#else +#define YYCOPY(Dst, Src, Count) \ + do { \ + YYPTRDIFF_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } while (0) +#endif +#endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 71 +#define YYFINAL 71 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 221 +#define YYLAST 221 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 75 +#define YYNTOKENS 75 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 54 +#define YYNNTS 54 /* YYNRULES -- Number of rules. */ -#define YYNRULES 131 +#define YYNRULES 131 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 232 +#define YYNSTATES 232 /* YYMAXUTOK -- Last valid token kind. */ -#define YYMAXUTOK 325 - +#define YYMAXUTOK 325 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ -#define YYTRANSLATE(YYX) \ - (0 <= (YYX) && (YYX) <= YYMAXUTOK \ - ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ - : YYSYMBOL_YYUNDEF) +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? YY_CAST(yysymbol_kind_t, yytranslate[YYX]) : YYSYMBOL_YYUNDEF) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ -static const yytype_int8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 72, 70, 2, 71, 2, 73, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 74 -}; +static const yytype_int8 yytranslate[] = {0, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 72, + 70, + 2, + 71, + 2, + 73, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 74}; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_int16 yyrline[] = -{ - 0, 227, 227, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 259, 265, 270, 276, 282, 288, - 294, 301, 307, 315, 325, 340, 341, 345, 351, 360, - 370, 391, 402, 405, 418, 430, 457, 461, 465, 470, - 476, 480, 481, 482, 483, 484, 488, 501, 507, 514, - 520, 528, 532, 536, 542, 549, 552, 559, 571, 585, - 590, 597, 607, 636, 669, 675, 684, 687, 696, 712, - 715, 718, 721, 724, 733, 736, 741, 747, 750, 753, - 760, 763, 766, 771, 778, 785, 790, 800, 806, 816, - 833, 840, 852, 855, 861, 865, 869, 876, 877, 878, - 879, 880, 881, 882, 883, 884, 885, 886, 887, 892, - 895, 903, 908, 916, 922, 928, 938, 943, 956, 964, - 974, 975 -}; +static const yytype_int16 yyrline[] = {0, + 227, + 227, + 235, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + 243, + 244, + 245, + 246, + 247, + 248, + 249, + 250, + 251, + 252, + 253, + 254, + 255, + 259, + 265, + 270, + 276, + 282, + 288, + 294, + 301, + 307, + 315, + 325, + 340, + 341, + 345, + 351, + 360, + 370, + 391, + 402, + 405, + 418, + 430, + 457, + 461, + 465, + 470, + 476, + 480, + 481, + 482, + 483, + 484, + 488, + 501, + 507, + 514, + 520, + 528, + 532, + 536, + 542, + 549, + 552, + 559, + 571, + 585, + 590, + 597, + 607, + 636, + 669, + 675, + 684, + 687, + 696, + 712, + 715, + 718, + 721, + 724, + 733, + 736, + 741, + 747, + 750, + 753, + 760, + 763, + 766, + 771, + 778, + 785, + 790, + 800, + 806, + 816, + 833, + 840, + 852, + 855, + 861, + 865, + 869, + 876, + 877, + 878, + 879, + 880, + 881, + 882, + 883, + 884, + 885, + 886, + 887, + 892, + 895, + 903, + 908, + 916, + 922, + 928, + 938, + 943, + 956, + 964, + 974, + 975}; #endif /** Accessing symbol of state STATE. */ -#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) +#define YY_ACCESSING_SYMBOL(State) YY_CAST(yysymbol_kind_t, yystos[State]) #if 1 /* The user-facing name of the symbol whose (internal) number is YYSYMBOL. No bounds checking. */ -static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; +static const char *yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "\"end of file\"", "error", "\"invalid token\"", "SEMICOLON", "AS", - "ASC", "BY", "CREATE", "DROP", "EXISTS", "GROUP", "ORDER", "TABLE", - "TABLES", "INDEX", "CALC", "SELECT", "DESC", "SHOW", "SYNC", "INSERT", - "DELETE", "UPDATE", "LBRACE", "RBRACE", "COMMA", "TRX_BEGIN", - "TRX_COMMIT", "TRX_ROLLBACK", "INT_T", "IN", "STRING_T", "FLOAT_T", - "DATE_T", "TEXT_T", "NOT", "UNIQUE", "NULL_T", "NULLABLE", "HELP", - "EXIT", "DOT", "INTO", "VALUES", "FROM", "WHERE", "AND", "OR", "SET", - "ON", "LOAD", "DATA", "INFILE", "EXPLAIN", "STORAGE", "FORMAT", "INNER", - "JOIN", "EQ", "LT", "GT", "LE", "GE", "NE", "LIKE", "IS", "NUMBER", - "FLOAT", "ID", "SSS", "'+'", "'-'", "'*'", "'/'", "UMINUS", "$accept", - "commands", "command_wrapper", "exit_stmt", "help_stmt", "sync_stmt", - "begin_stmt", "commit_stmt", "rollback_stmt", "drop_table_stmt", - "show_tables_stmt", "desc_table_stmt", "show_index_stmt", - "create_index_stmt", "opt_unique", "attr_list", "drop_index_stmt", - "create_table_stmt", "attr_def_list", "attr_def", "nullable_constraint", - "number", "type", "insert_stmt", "values_list", "value_list", "value", - "storage_format", "delete_stmt", "update_stmt", "setClauses", - "setClause", "select_stmt", "calc_stmt", "expression_list", "expression", - "alias", "aggr_func_expr", "sub_query_expr", "rel_attr", "relation", - "rel_list", "joinClauses", "where", "condition", "comp_op", - "opt_order_by", "sort_list", "sort_unit", "group_by", "load_data_stmt", - "explain_stmt", "set_variable_stmt", "opt_semicolon", YY_NULLPTR -}; - -static const char * -yysymbol_name (yysymbol_kind_t yysymbol) -{ - return yytname[yysymbol]; -} +static const char *const yytname[] = {"\"end of file\"", + "error", + "\"invalid token\"", + "SEMICOLON", + "AS", + "ASC", + "BY", + "CREATE", + "DROP", + "EXISTS", + "GROUP", + "ORDER", + "TABLE", + "TABLES", + "INDEX", + "CALC", + "SELECT", + "DESC", + "SHOW", + "SYNC", + "INSERT", + "DELETE", + "UPDATE", + "LBRACE", + "RBRACE", + "COMMA", + "TRX_BEGIN", + "TRX_COMMIT", + "TRX_ROLLBACK", + "INT_T", + "IN", + "STRING_T", + "FLOAT_T", + "DATE_T", + "TEXT_T", + "NOT", + "UNIQUE", + "NULL_T", + "NULLABLE", + "HELP", + "EXIT", + "DOT", + "INTO", + "VALUES", + "FROM", + "WHERE", + "AND", + "OR", + "SET", + "ON", + "LOAD", + "DATA", + "INFILE", + "EXPLAIN", + "STORAGE", + "FORMAT", + "INNER", + "JOIN", + "EQ", + "LT", + "GT", + "LE", + "GE", + "NE", + "LIKE", + "IS", + "NUMBER", + "FLOAT", + "ID", + "SSS", + "'+'", + "'-'", + "'*'", + "'/'", + "UMINUS", + "$accept", + "commands", + "command_wrapper", + "exit_stmt", + "help_stmt", + "sync_stmt", + "begin_stmt", + "commit_stmt", + "rollback_stmt", + "drop_table_stmt", + "show_tables_stmt", + "desc_table_stmt", + "show_index_stmt", + "create_index_stmt", + "opt_unique", + "attr_list", + "drop_index_stmt", + "create_table_stmt", + "attr_def_list", + "attr_def", + "nullable_constraint", + "number", + "type", + "insert_stmt", + "values_list", + "value_list", + "value", + "storage_format", + "delete_stmt", + "update_stmt", + "setClauses", + "setClause", + "select_stmt", + "calc_stmt", + "expression_list", + "expression", + "alias", + "aggr_func_expr", + "sub_query_expr", + "rel_attr", + "relation", + "rel_list", + "joinClauses", + "where", + "condition", + "comp_op", + "opt_order_by", + "sort_list", + "sort_unit", + "group_by", + "load_data_stmt", + "explain_stmt", + "set_variable_stmt", + "opt_semicolon", + YY_NULLPTR}; + +static const char *yysymbol_name(yysymbol_kind_t yysymbol) { return yytname[yysymbol]; } #endif #define YYPACT_NINF (-158) -#define yypact_value_is_default(Yyn) \ - ((Yyn) == YYPACT_NINF) +#define yypact_value_is_default(Yyn) ((Yyn) == YYPACT_NINF) #define YYTABLE_NINF (-1) -#define yytable_value_is_error(Yyn) \ - 0 +#define yytable_value_is_error(Yyn) 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -static const yytype_int16 yypact[] = -{ - 106, -5, 46, 39, 39, -51, 50, -158, -21, -20, - -38, -158, -158, -158, -158, -158, -25, 2, 106, 51, - 43, -158, -158, -158, -158, -158, -158, -158, -158, -158, - -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, - -158, -158, -7, -158, 52, 19, 24, 22, -158, -158, - -158, -4, -158, 39, -158, -158, -158, -1, -158, -158, - -158, 41, -158, -158, 54, 44, 61, 72, 73, 78, - -158, -158, -158, -158, 16, 75, -158, 95, 39, 123, - 124, 39, 81, -158, 82, -158, 39, 39, 39, 39, - 126, 84, 84, 114, 113, 92, -19, 93, 145, 103, - 130, 104, 41, -158, -158, 149, -158, -158, 11, 11, - -158, -158, 39, -158, 0, 113, -158, 157, 39, -158, - 125, -16, -158, -158, 139, -158, 68, 159, 118, -158, - -158, -158, 128, 162, -158, -19, 163, 105, 57, 39, - 92, -158, 170, -158, -158, -158, -158, -158, 17, 103, - 165, 167, 84, 84, 180, 94, -158, 169, -158, -22, - -158, -158, -158, -158, -158, -158, -158, 158, 39, 39, - 39, 66, -158, 127, 131, 161, -158, -158, -158, 159, - 140, 132, 147, 113, 6, -158, 193, -158, -158, -19, - -19, -158, -158, -158, 66, -158, 155, -158, -158, 178, - -158, -158, 148, -158, 179, 181, 39, -158, 39, -158, - 117, -10, 150, 132, -158, -24, -158, 9, -158, 182, - -158, -158, 138, -158, 152, -158, -158, 39, -158, 84, - -158, -158 -}; +static const yytype_int16 yypact[] = {106, + -5, + 46, + 39, + 39, + -51, + 50, + -158, + -21, + -20, + -38, + -158, + -158, + -158, + -158, + -158, + -25, + 2, + 106, + 51, + 43, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -7, + -158, + 52, + 19, + 24, + 22, + -158, + -158, + -158, + -4, + -158, + 39, + -158, + -158, + -158, + -1, + -158, + -158, + -158, + 41, + -158, + -158, + 54, + 44, + 61, + 72, + 73, + 78, + -158, + -158, + -158, + -158, + 16, + 75, + -158, + 95, + 39, + 123, + 124, + 39, + 81, + -158, + 82, + -158, + 39, + 39, + 39, + 39, + 126, + 84, + 84, + 114, + 113, + 92, + -19, + 93, + 145, + 103, + 130, + 104, + 41, + -158, + -158, + 149, + -158, + -158, + 11, + 11, + -158, + -158, + 39, + -158, + 0, + 113, + -158, + 157, + 39, + -158, + 125, + -16, + -158, + -158, + 139, + -158, + 68, + 159, + 118, + -158, + -158, + -158, + 128, + 162, + -158, + -19, + 163, + 105, + 57, + 39, + 92, + -158, + 170, + -158, + -158, + -158, + -158, + -158, + 17, + 103, + 165, + 167, + 84, + 84, + 180, + 94, + -158, + 169, + -158, + -22, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + 158, + 39, + 39, + 39, + 66, + -158, + 127, + 131, + 161, + -158, + -158, + -158, + 159, + 140, + 132, + 147, + 113, + 6, + -158, + 193, + -158, + -158, + -19, + -19, + -158, + -158, + -158, + 66, + -158, + 155, + -158, + -158, + 178, + -158, + -158, + 148, + -158, + 179, + 181, + 39, + -158, + 39, + -158, + 117, + -10, + 150, + 132, + -158, + -24, + -158, + 9, + -158, + 182, + -158, + -158, + 138, + -158, + 152, + -158, + -158, + 39, + -158, + 84, + -158, + -158}; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 36, 0, 76, 76, 0, 0, 26, 0, 0, - 0, 27, 28, 29, 25, 24, 0, 0, 0, 0, - 130, 23, 22, 15, 16, 17, 18, 9, 10, 11, - 14, 12, 13, 8, 5, 7, 6, 4, 3, 19, - 20, 21, 0, 35, 0, 0, 0, 76, 64, 61, - 62, 95, 63, 0, 87, 85, 74, 90, 88, 89, - 86, 75, 32, 31, 0, 0, 0, 0, 0, 0, - 128, 1, 131, 2, 0, 0, 30, 0, 76, 0, - 0, 76, 0, 84, 0, 91, 0, 0, 0, 0, - 77, 0, 0, 0, 102, 0, 0, 0, 0, 0, - 0, 0, 0, 94, 83, 0, 96, 92, 79, 80, - 81, 82, 76, 97, 90, 102, 33, 0, 0, 67, - 0, 102, 69, 129, 0, 41, 0, 42, 0, 39, - 93, 78, 0, 98, 126, 0, 56, 0, 103, 0, - 0, 68, 0, 51, 52, 53, 54, 55, 49, 0, - 0, 0, 0, 0, 119, 0, 59, 0, 117, 0, - 107, 108, 109, 110, 111, 112, 115, 113, 0, 0, - 0, 71, 70, 0, 0, 0, 48, 47, 45, 42, - 65, 0, 0, 102, 90, 99, 0, 72, 57, 0, - 0, 118, 116, 114, 104, 105, 106, 127, 50, 0, - 46, 43, 0, 40, 37, 0, 0, 126, 0, 60, - 0, 49, 0, 0, 34, 100, 73, 123, 120, 121, - 58, 44, 0, 38, 0, 125, 124, 0, 66, 0, - 122, 101 -}; +static const yytype_uint8 yydefact[] = {0, + 36, + 0, + 76, + 76, + 0, + 0, + 26, + 0, + 0, + 0, + 27, + 28, + 29, + 25, + 24, + 0, + 0, + 0, + 0, + 130, + 23, + 22, + 15, + 16, + 17, + 18, + 9, + 10, + 11, + 14, + 12, + 13, + 8, + 5, + 7, + 6, + 4, + 3, + 19, + 20, + 21, + 0, + 35, + 0, + 0, + 0, + 76, + 64, + 61, + 62, + 95, + 63, + 0, + 87, + 85, + 74, + 90, + 88, + 89, + 86, + 75, + 32, + 31, + 0, + 0, + 0, + 0, + 0, + 0, + 128, + 1, + 131, + 2, + 0, + 0, + 30, + 0, + 76, + 0, + 0, + 76, + 0, + 84, + 0, + 91, + 0, + 0, + 0, + 0, + 77, + 0, + 0, + 0, + 102, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 94, + 83, + 0, + 96, + 92, + 79, + 80, + 81, + 82, + 76, + 97, + 90, + 102, + 33, + 0, + 0, + 67, + 0, + 102, + 69, + 129, + 0, + 41, + 0, + 42, + 0, + 39, + 93, + 78, + 0, + 98, + 126, + 0, + 56, + 0, + 103, + 0, + 0, + 68, + 0, + 51, + 52, + 53, + 54, + 55, + 49, + 0, + 0, + 0, + 0, + 0, + 119, + 0, + 59, + 0, + 117, + 0, + 107, + 108, + 109, + 110, + 111, + 112, + 115, + 113, + 0, + 0, + 0, + 71, + 70, + 0, + 0, + 0, + 48, + 47, + 45, + 42, + 65, + 0, + 0, + 102, + 90, + 99, + 0, + 72, + 57, + 0, + 0, + 118, + 116, + 114, + 104, + 105, + 106, + 127, + 50, + 0, + 46, + 43, + 0, + 40, + 37, + 0, + 0, + 126, + 0, + 60, + 0, + 49, + 0, + 0, + 34, + 100, + 73, + 123, + 120, + 121, + 58, + 44, + 0, + 38, + 0, + 125, + 124, + 0, + 66, + 0, + 122, + 101}; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -158, -158, 192, -158, -158, -158, -158, -158, -158, -158, - -158, -158, -158, -158, -158, -2, -158, -158, 33, 64, - 3, -158, -158, -158, -158, 25, -94, -158, -158, -158, - -158, 76, -41, -158, -3, -53, 160, -158, -158, -158, - -76, 65, -9, -110, -157, -158, -158, -8, -158, 14, - -158, -158, -158, -158 -}; +static const yytype_int16 yypgoto[] = {-158, + -158, + 192, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -158, + -2, + -158, + -158, + 33, + 64, + 3, + -158, + -158, + -158, + -158, + 25, + -94, + -158, + -158, + -158, + -158, + 76, + -41, + -158, + -3, + -53, + 160, + -158, + -158, + -158, + -76, + 65, + -9, + -110, + -157, + -158, + -158, + -8, + -158, + 14, + -158, + -158, + -158, + -158}; /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_uint8 yydefgoto[] = -{ - 0, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 44, 205, 32, 33, 150, 127, - 178, 199, 148, 34, 136, 155, 55, 203, 35, 36, - 121, 122, 37, 38, 56, 57, 133, 58, 59, 60, - 182, 115, 183, 119, 138, 168, 187, 218, 219, 154, - 39, 40, 41, 73 -}; +static const yytype_uint8 yydefgoto[] = {0, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 44, + 205, + 32, + 33, + 150, + 127, + 178, + 199, + 148, + 34, + 136, + 155, + 55, + 203, + 35, + 36, + 121, + 122, + 37, + 38, + 56, + 57, + 133, + 58, + 59, + 60, + 182, + 115, + 183, + 119, + 138, + 168, + 187, + 218, + 219, + 154, + 39, + 40, + 41, + 73}; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_uint8 yytable[] = -{ - 83, 61, 123, 84, 84, 134, 79, 42, 191, 140, - 84, 141, 195, 196, 225, 114, 116, 62, 48, 81, - 98, 65, 169, 170, 66, 175, 226, 176, 177, 118, - 67, 43, 224, 108, 109, 110, 111, 82, 78, 99, - 174, 156, 192, 68, 80, 47, 72, 49, 50, 215, - 52, 71, 175, 69, 176, 177, 132, 125, 45, 48, - 46, 74, 47, 63, 64, 137, 75, 85, 85, 86, - 87, 88, 89, 207, 85, 102, 48, 184, 105, 86, - 87, 88, 89, 88, 89, 91, 171, 76, 49, 50, - 51, 52, 77, 53, 54, 209, 156, 143, 92, 144, - 145, 146, 147, 169, 170, 49, 50, 51, 52, 131, - 53, 54, 93, 1, 2, 194, 137, 137, 188, 189, - 95, 3, 4, 5, 6, 7, 8, 9, 10, 94, - 97, 96, 11, 12, 13, 158, 86, 87, 88, 89, - 159, 220, 189, 100, 101, 14, 15, 103, 104, 106, - 107, 112, 113, 137, 16, 217, 17, 117, 118, 18, - 120, 78, 124, 160, 161, 162, 163, 164, 165, 166, - 167, 126, 129, 130, 217, 86, 87, 88, 89, 128, - 135, 142, 173, 139, 149, 152, 151, 153, 157, 180, - 181, 186, 190, 193, 202, 197, 206, 198, 200, 208, - 204, 169, 211, 212, 213, 214, 228, 227, 222, 229, - 70, 223, 201, 179, 221, 210, 172, 90, 185, 230, - 231, 216 -}; - -static const yytype_uint8 yycheck[] = -{ - 53, 4, 96, 4, 4, 115, 47, 12, 30, 25, - 4, 121, 169, 170, 5, 91, 92, 68, 37, 23, - 4, 42, 46, 47, 44, 35, 17, 37, 38, 45, - 68, 36, 56, 86, 87, 88, 89, 41, 16, 23, - 23, 135, 64, 68, 47, 23, 3, 66, 67, 206, - 69, 0, 35, 51, 37, 38, 56, 98, 12, 37, - 14, 68, 23, 13, 14, 118, 14, 68, 68, 70, - 71, 72, 73, 183, 68, 78, 37, 153, 81, 70, - 71, 72, 73, 72, 73, 44, 139, 68, 66, 67, - 68, 69, 68, 71, 72, 189, 190, 29, 44, 31, - 32, 33, 34, 46, 47, 66, 67, 68, 69, 112, - 71, 72, 68, 7, 8, 168, 169, 170, 24, 25, - 48, 15, 16, 17, 18, 19, 20, 21, 22, 68, - 52, 58, 26, 27, 28, 30, 70, 71, 72, 73, - 35, 24, 25, 68, 49, 39, 40, 24, 24, 68, - 68, 25, 68, 206, 48, 208, 50, 43, 45, 53, - 68, 16, 69, 58, 59, 60, 61, 62, 63, 64, - 65, 68, 68, 24, 227, 70, 71, 72, 73, 49, - 23, 42, 12, 58, 25, 57, 68, 25, 25, 24, - 23, 11, 23, 35, 54, 68, 49, 66, 37, 6, - 68, 46, 24, 55, 25, 24, 68, 25, 58, 57, - 18, 213, 179, 149, 211, 190, 140, 57, 153, 227, - 229, 207 -}; +static const yytype_uint8 yytable[] = {83, + 61, + 123, + 84, + 84, + 134, + 79, + 42, + 191, + 140, + 84, + 141, + 195, + 196, + 225, + 114, + 116, + 62, + 48, + 81, + 98, + 65, + 169, + 170, + 66, + 175, + 226, + 176, + 177, + 118, + 67, + 43, + 224, + 108, + 109, + 110, + 111, + 82, + 78, + 99, + 174, + 156, + 192, + 68, + 80, + 47, + 72, + 49, + 50, + 215, + 52, + 71, + 175, + 69, + 176, + 177, + 132, + 125, + 45, + 48, + 46, + 74, + 47, + 63, + 64, + 137, + 75, + 85, + 85, + 86, + 87, + 88, + 89, + 207, + 85, + 102, + 48, + 184, + 105, + 86, + 87, + 88, + 89, + 88, + 89, + 91, + 171, + 76, + 49, + 50, + 51, + 52, + 77, + 53, + 54, + 209, + 156, + 143, + 92, + 144, + 145, + 146, + 147, + 169, + 170, + 49, + 50, + 51, + 52, + 131, + 53, + 54, + 93, + 1, + 2, + 194, + 137, + 137, + 188, + 189, + 95, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 94, + 97, + 96, + 11, + 12, + 13, + 158, + 86, + 87, + 88, + 89, + 159, + 220, + 189, + 100, + 101, + 14, + 15, + 103, + 104, + 106, + 107, + 112, + 113, + 137, + 16, + 217, + 17, + 117, + 118, + 18, + 120, + 78, + 124, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 126, + 129, + 130, + 217, + 86, + 87, + 88, + 89, + 128, + 135, + 142, + 173, + 139, + 149, + 152, + 151, + 153, + 157, + 180, + 181, + 186, + 190, + 193, + 202, + 197, + 206, + 198, + 200, + 208, + 204, + 169, + 211, + 212, + 213, + 214, + 228, + 227, + 222, + 229, + 70, + 223, + 201, + 179, + 221, + 210, + 172, + 90, + 185, + 230, + 231, + 216}; + +static const yytype_uint8 yycheck[] = {53, + 4, + 96, + 4, + 4, + 115, + 47, + 12, + 30, + 25, + 4, + 121, + 169, + 170, + 5, + 91, + 92, + 68, + 37, + 23, + 4, + 42, + 46, + 47, + 44, + 35, + 17, + 37, + 38, + 45, + 68, + 36, + 56, + 86, + 87, + 88, + 89, + 41, + 16, + 23, + 23, + 135, + 64, + 68, + 47, + 23, + 3, + 66, + 67, + 206, + 69, + 0, + 35, + 51, + 37, + 38, + 56, + 98, + 12, + 37, + 14, + 68, + 23, + 13, + 14, + 118, + 14, + 68, + 68, + 70, + 71, + 72, + 73, + 183, + 68, + 78, + 37, + 153, + 81, + 70, + 71, + 72, + 73, + 72, + 73, + 44, + 139, + 68, + 66, + 67, + 68, + 69, + 68, + 71, + 72, + 189, + 190, + 29, + 44, + 31, + 32, + 33, + 34, + 46, + 47, + 66, + 67, + 68, + 69, + 112, + 71, + 72, + 68, + 7, + 8, + 168, + 169, + 170, + 24, + 25, + 48, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 68, + 52, + 58, + 26, + 27, + 28, + 30, + 70, + 71, + 72, + 73, + 35, + 24, + 25, + 68, + 49, + 39, + 40, + 24, + 24, + 68, + 68, + 25, + 68, + 206, + 48, + 208, + 50, + 43, + 45, + 53, + 68, + 16, + 69, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 68, + 68, + 24, + 227, + 70, + 71, + 72, + 73, + 49, + 23, + 42, + 12, + 58, + 25, + 57, + 68, + 25, + 25, + 24, + 23, + 11, + 23, + 35, + 54, + 68, + 49, + 66, + 37, + 6, + 68, + 46, + 24, + 55, + 25, + 24, + 68, + 25, + 58, + 57, + 18, + 213, + 179, + 149, + 211, + 190, + 140, + 57, + 153, + 227, + 229, + 207}; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 7, 8, 15, 16, 17, 18, 19, 20, 21, - 22, 26, 27, 28, 39, 40, 48, 50, 53, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 91, 92, 98, 103, 104, 107, 108, 125, - 126, 127, 12, 36, 89, 12, 14, 23, 37, 66, - 67, 68, 69, 71, 72, 101, 109, 110, 112, 113, - 114, 109, 68, 13, 14, 42, 44, 68, 68, 51, - 77, 0, 3, 128, 68, 14, 68, 68, 16, 107, - 109, 23, 41, 110, 4, 68, 70, 71, 72, 73, - 111, 44, 44, 68, 68, 48, 58, 52, 4, 23, - 68, 49, 109, 24, 24, 109, 68, 68, 110, 110, - 110, 110, 25, 68, 115, 116, 115, 43, 45, 118, - 68, 105, 106, 101, 69, 107, 68, 94, 49, 68, - 24, 109, 56, 111, 118, 23, 99, 110, 119, 58, - 25, 118, 42, 29, 31, 32, 33, 34, 97, 25, - 93, 68, 57, 25, 124, 100, 101, 25, 30, 35, - 58, 59, 60, 61, 62, 63, 64, 65, 120, 46, - 47, 110, 106, 12, 23, 35, 37, 38, 95, 94, - 24, 23, 115, 117, 115, 116, 11, 121, 24, 25, - 23, 30, 64, 35, 110, 119, 119, 68, 66, 96, - 37, 93, 54, 102, 68, 90, 49, 118, 6, 101, - 100, 24, 55, 25, 24, 119, 124, 110, 122, 123, - 24, 95, 58, 90, 56, 5, 17, 25, 68, 57, - 122, 117 -}; +static const yytype_uint8 yystos[] = {0, + 7, + 8, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 26, + 27, + 28, + 39, + 40, + 48, + 50, + 53, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 91, + 92, + 98, + 103, + 104, + 107, + 108, + 125, + 126, + 127, + 12, + 36, + 89, + 12, + 14, + 23, + 37, + 66, + 67, + 68, + 69, + 71, + 72, + 101, + 109, + 110, + 112, + 113, + 114, + 109, + 68, + 13, + 14, + 42, + 44, + 68, + 68, + 51, + 77, + 0, + 3, + 128, + 68, + 14, + 68, + 68, + 16, + 107, + 109, + 23, + 41, + 110, + 4, + 68, + 70, + 71, + 72, + 73, + 111, + 44, + 44, + 68, + 68, + 48, + 58, + 52, + 4, + 23, + 68, + 49, + 109, + 24, + 24, + 109, + 68, + 68, + 110, + 110, + 110, + 110, + 25, + 68, + 115, + 116, + 115, + 43, + 45, + 118, + 68, + 105, + 106, + 101, + 69, + 107, + 68, + 94, + 49, + 68, + 24, + 109, + 56, + 111, + 118, + 23, + 99, + 110, + 119, + 58, + 25, + 118, + 42, + 29, + 31, + 32, + 33, + 34, + 97, + 25, + 93, + 68, + 57, + 25, + 124, + 100, + 101, + 25, + 30, + 35, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 120, + 46, + 47, + 110, + 106, + 12, + 23, + 35, + 37, + 38, + 95, + 94, + 24, + 23, + 115, + 117, + 115, + 116, + 11, + 121, + 24, + 25, + 23, + 30, + 64, + 35, + 110, + 119, + 119, + 68, + 66, + 96, + 37, + 93, + 54, + 102, + 68, + 90, + 49, + 118, + 6, + 101, + 100, + 24, + 55, + 25, + 24, + 119, + 124, + 110, + 122, + 123, + 24, + 95, + 58, + 90, + 56, + 5, + 17, + 25, + 68, + 57, + 122, + 117}; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ -static const yytype_uint8 yyr1[] = -{ - 0, 75, 76, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 89, 90, 90, 91, - 92, 92, 93, 93, 94, 94, 95, 95, 95, 95, - 96, 97, 97, 97, 97, 97, 98, 99, 99, 100, - 100, 101, 101, 101, 101, 102, 102, 103, 104, 105, - 105, 106, 107, 107, 108, 108, 109, 109, 109, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 111, 111, 111, 112, 113, 114, 114, 115, 116, 116, - 117, 117, 118, 118, 119, 119, 119, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 121, - 121, 122, 122, 123, 123, 123, 124, 125, 126, 127, - 128, 128 -}; +static const yytype_uint8 yyr1[] = {0, + 75, + 76, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 89, + 90, + 90, + 91, + 92, + 92, + 93, + 93, + 94, + 94, + 95, + 95, + 95, + 95, + 96, + 97, + 97, + 97, + 97, + 97, + 98, + 99, + 99, + 100, + 100, + 101, + 101, + 101, + 101, + 102, + 102, + 103, + 104, + 105, + 105, + 106, + 107, + 107, + 108, + 108, + 109, + 109, + 109, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 110, + 111, + 111, + 111, + 112, + 113, + 114, + 114, + 115, + 116, + 116, + 117, + 117, + 118, + 118, + 119, + 119, + 119, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 120, + 121, + 121, + 122, + 122, + 123, + 123, + 123, + 124, + 125, + 126, + 127, + 128, + 128}; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ -static const yytype_int8 yyr2[] = +static const yytype_int8 yyr2[] = {0, + 2, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 3, + 2, + 2, + 4, + 9, + 1, + 0, + 1, + 3, + 5, + 8, + 5, + 0, + 3, + 6, + 3, + 2, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 5, + 3, + 5, + 1, + 3, + 1, + 1, + 1, + 1, + 0, + 4, + 4, + 5, + 1, + 3, + 3, + 7, + 9, + 2, + 2, + 0, + 2, + 4, + 3, + 3, + 3, + 3, + 3, + 2, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 2, + 4, + 3, + 1, + 3, + 1, + 2, + 4, + 3, + 6, + 0, + 2, + 3, + 3, + 3, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 1, + 2, + 1, + 2, + 0, + 3, + 1, + 3, + 1, + 2, + 2, + 0, + 7, + 2, + 4, + 0, + 1}; + +enum { - 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 2, 2, 4, 9, 1, 0, 1, 3, 5, - 8, 5, 0, 3, 6, 3, 2, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 5, 3, 5, 1, - 3, 1, 1, 1, 1, 0, 4, 4, 5, 1, - 3, 3, 7, 9, 2, 2, 0, 2, 4, 3, - 3, 3, 3, 3, 2, 1, 1, 1, 1, 1, - 0, 1, 2, 4, 3, 1, 3, 1, 2, 4, - 3, 6, 0, 2, 3, 3, 3, 1, 1, 1, - 1, 1, 1, 1, 2, 1, 2, 1, 2, 0, - 3, 1, 3, 1, 2, 2, 0, 7, 2, 4, - 0, 1 + YYENOMEM = -2 }; - -enum { YYENOMEM = -2 }; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab -#define YYNOMEM goto yyexhaustedlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (&yylloc, sql_string, sql_result, scanner, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK(yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } else { \ + yyerror(&yylloc, sql_string, sql_result, scanner, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ while (0) /* Backward compatibility with an undocumented macro. @@ -991,151 +2783,131 @@ enum { YYENOMEM = -2 }; the previous symbol: RHS[0] (always defined). */ #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (N) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (0) +#define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + } else { \ + (Current).first_line = (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = YYRHSLOC(Rhs, 0).last_column; \ + } \ + while (0) #endif #define YYRHSLOC(Rhs, K) ((Rhs)[K]) - /* Enable debugging if requested. */ #if YYDEBUG -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) +#ifndef YYFPRINTF +#include /* INFRINGES ON USER NAME SPACE */ +#define YYFPRINTF fprintf +#endif +#define YYDPRINTF(Args) \ + do { \ + if (yydebug) \ + YYFPRINTF Args; \ + } while (0) /* YYLOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ -# ifndef YYLOCATION_PRINT +#ifndef YYLOCATION_PRINT -# if defined YY_LOCATION_PRINT +#if defined YY_LOCATION_PRINT - /* Temporary convenience wrapper in case some people defined the - undocumented and private YY_LOCATION_PRINT macros. */ -# define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc)) +/* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +#define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc)) -# elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +#elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ YY_ATTRIBUTE_UNUSED -static int -yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) +static int yy_location_print_(FILE *yyo, YYLTYPE const *const yylocp) { - int res = 0; + int res = 0; int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; - if (0 <= yylocp->first_line) - { - res += YYFPRINTF (yyo, "%d", yylocp->first_line); - if (0 <= yylocp->first_column) - res += YYFPRINTF (yyo, ".%d", yylocp->first_column); - } - if (0 <= yylocp->last_line) - { - if (yylocp->first_line < yylocp->last_line) - { - res += YYFPRINTF (yyo, "-%d", yylocp->last_line); - if (0 <= end_col) - res += YYFPRINTF (yyo, ".%d", end_col); - } - else if (0 <= end_col && yylocp->first_column < end_col) - res += YYFPRINTF (yyo, "-%d", end_col); - } + if (0 <= yylocp->first_line) { + res += YYFPRINTF(yyo, "%d", yylocp->first_line); + if (0 <= yylocp->first_column) + res += YYFPRINTF(yyo, ".%d", yylocp->first_column); + } + if (0 <= yylocp->last_line) { + if (yylocp->first_line < yylocp->last_line) { + res += YYFPRINTF(yyo, "-%d", yylocp->last_line); + if (0 <= end_col) + res += YYFPRINTF(yyo, ".%d", end_col); + } else if (0 <= end_col && yylocp->first_column < end_col) + res += YYFPRINTF(yyo, "-%d", end_col); + } return res; } -# define YYLOCATION_PRINT yy_location_print_ - - /* Temporary convenience wrapper in case some people defined the - undocumented and private YY_LOCATION_PRINT macros. */ -# define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc)) - -# else +#define YYLOCATION_PRINT yy_location_print_ -# define YYLOCATION_PRINT(File, Loc) ((void) 0) - /* Temporary convenience wrapper in case some people defined the - undocumented and private YY_LOCATION_PRINT macros. */ -# define YY_LOCATION_PRINT YYLOCATION_PRINT +/* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +#define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc)) -# endif -# endif /* !defined YYLOCATION_PRINT */ +#else +#define YYLOCATION_PRINT(File, Loc) ((void)0) +/* Temporary convenience wrapper in case some people defined the + undocumented and private YY_LOCATION_PRINT macros. */ +#define YY_LOCATION_PRINT YYLOCATION_PRINT -# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Kind, Value, Location, sql_string, sql_result, scanner); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) +#endif +#endif /* !defined YYLOCATION_PRINT */ +#define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ + do { \ + if (yydebug) { \ + YYFPRINTF(stderr, "%s ", Title); \ + yy_symbol_print(stderr, Kind, Value, Location, sql_string, sql_result, scanner); \ + YYFPRINTF(stderr, "\n"); \ + } \ + } while (0) /*-----------------------------------. | Print this symbol's value on YYO. | `-----------------------------------*/ -static void -yy_symbol_value_print (FILE *yyo, - yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, const char * sql_string, ParsedSqlResult * sql_result, void * scanner) +static void yy_symbol_value_print(FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, + YYLTYPE const *const yylocationp, const char *sql_string, ParsedSqlResult *sql_result, void *scanner) { FILE *yyoutput = yyo; - YY_USE (yyoutput); - YY_USE (yylocationp); - YY_USE (sql_string); - YY_USE (sql_result); - YY_USE (scanner); + YY_USE(yyoutput); + YY_USE(yylocationp); + YY_USE(sql_string); + YY_USE(sql_result); + YY_USE(scanner); if (!yyvaluep) return; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YY_USE (yykind); + YY_USE(yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } - /*---------------------------. | Print this symbol on YYO. | `---------------------------*/ -static void -yy_symbol_print (FILE *yyo, - yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, const char * sql_string, ParsedSqlResult * sql_result, void * scanner) +static void yy_symbol_print(FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const *const yyvaluep, + YYLTYPE const *const yylocationp, const char *sql_string, ParsedSqlResult *sql_result, void *scanner) { - YYFPRINTF (yyo, "%s %s (", - yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); + YYFPRINTF(yyo, "%s %s (", yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name(yykind)); - YYLOCATION_PRINT (yyo, yylocationp); - YYFPRINTF (yyo, ": "); - yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, sql_string, sql_result, scanner); - YYFPRINTF (yyo, ")"); + YYLOCATION_PRINT(yyo, yylocationp); + YYFPRINTF(yyo, ": "); + yy_symbol_value_print(yyo, yykind, yyvaluep, yylocationp, sql_string, sql_result, scanner); + YYFPRINTF(yyo, ")"); } /*------------------------------------------------------------------. @@ -1143,70 +2915,66 @@ yy_symbol_print (FILE *yyo, | TOP (included). | `------------------------------------------------------------------*/ -static void -yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +static void yy_stack_print(yy_state_t *yybottom, yy_state_t *yytop) { - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); + YYFPRINTF(stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) { + int yybot = *yybottom; + YYFPRINTF(stderr, " %d", yybot); + } + YYFPRINTF(stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - +#define YY_STACK_PRINT(Bottom, Top) \ + do { \ + if (yydebug) \ + yy_stack_print((Bottom), (Top)); \ + } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -static void -yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, - int yyrule, const char * sql_string, ParsedSqlResult * sql_result, void * scanner) +static void yy_reduce_print(yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, const char *sql_string, + ParsedSqlResult *sql_result, void *scanner) { - int yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", - yyrule - 1, yylno); + YYFPRINTF(stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), - &yyvsp[(yyi + 1) - (yynrhs)], - &(yylsp[(yyi + 1) - (yynrhs)]), sql_string, sql_result, scanner); - YYFPRINTF (stderr, "\n"); - } + for (yyi = 0; yyi < yynrhs; yyi++) { + YYFPRINTF(stderr, " $%d = ", yyi + 1); + yy_symbol_print(stderr, + YY_ACCESSING_SYMBOL(+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)], + &(yylsp[(yyi + 1) - (yynrhs)]), + sql_string, + sql_result, + scanner); + YYFPRINTF(stderr, "\n"); + } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, yylsp, Rule, sql_string, sql_result, scanner); \ -} while (0) +#define YY_REDUCE_PRINT(Rule) \ + do { \ + if (yydebug) \ + yy_reduce_print(yyssp, yyvsp, yylsp, Rule, sql_string, sql_result, scanner); \ + } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) ((void) 0) -# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) +#define YYDPRINTF(Args) ((void)0) +#define YY_SYMBOL_PRINT(Title, Kind, Value, Location) +#define YY_STACK_PRINT(Bottom, Top) +#define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ - /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -# define YYINITDEPTH 200 +#define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only @@ -1217,16 +2985,15 @@ int yydebug; evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 +#define YYMAXDEPTH 10000 #endif - /* Context of a parse error. */ typedef struct { - yy_state_t *yyssp; + yy_state_t *yyssp; yysymbol_kind_t yytoken; - YYLTYPE *yylloc; + YYLTYPE *yylloc; } yypcontext_t; /* Put in YYARG at most YYARGN of the expected tokens given the @@ -1235,69 +3002,59 @@ typedef struct be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. Return 0 if there are more than YYARGN expected tokens, yet fill YYARG up to YYARGN. */ -static int -yypcontext_expected_tokens (const yypcontext_t *yyctx, - yysymbol_kind_t yyarg[], int yyargn) +static int yypcontext_expected_tokens(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn) { /* Actual size of YYARG. */ int yycount = 0; - int yyn = yypact[+*yyctx->yyssp]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (!yyarg) - ++yycount; - else if (yycount == yyargn) - return 0; - else - yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); - } - } + int yyn = yypact[+*yyctx->yyssp]; + if (!yypact_value_is_default(yyn)) { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror && !yytable_value_is_error(yytable[yyx + yyn])) { + if (!yyarg) + ++yycount; + else if (yycount == yyargn) + return 0; + else + yyarg[yycount++] = YY_CAST(yysymbol_kind_t, yyx); + } + } if (yyarg && yycount == 0 && 0 < yyargn) yyarg[0] = YYSYMBOL_YYEMPTY; return yycount; } - - - #ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) -# else +#if defined __GLIBC__ && defined _STRING_H +#define yystrlen(S) (YY_CAST(YYPTRDIFF_T, strlen(S))) +#else /* Return the length of YYSTR. */ -static YYPTRDIFF_T -yystrlen (const char *yystr) +static YYPTRDIFF_T yystrlen(const char *yystr) { YYPTRDIFF_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } -# endif +#endif #endif #ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else +#if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +#define yystpcpy stpcpy +#else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) +static char *yystpcpy(char *yydest, const char *yysrc) { - char *yyd = yydest; + char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') @@ -1305,7 +3062,7 @@ yystpcpy (char *yydest, const char *yysrc) return yyd - 1; } -# endif +#endif #endif #ifndef yytnamerr @@ -1316,52 +3073,45 @@ yystpcpy (char *yydest, const char *yysrc) backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ -static YYPTRDIFF_T -yytnamerr (char *yyres, const char *yystr) +static YYPTRDIFF_T yytnamerr(char *yyres, const char *yystr) { - if (*yystr == '"') - { - YYPTRDIFF_T yyn = 0; - char const *yyp = yystr; - for (;;) - switch (*++yyp) - { - case '\'': - case ',': + if (*yystr == '"') { + YYPTRDIFF_T yyn = 0; + char const *yyp = yystr; + for (;;) + switch (*++yyp) { + case '\'': + case ',': goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - else - goto append; - - append: - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } + else + goto append; + + append: + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes:; + } if (yyres) - return yystpcpy (yyres, yystr) - yyres; + return yystpcpy(yyres, yystr) - yyres; else - return yystrlen (yystr); + return yystrlen(yystr); } #endif - -static int -yy_syntax_error_arguments (const yypcontext_t *yyctx, - yysymbol_kind_t yyarg[], int yyargn) +static int yy_syntax_error_arguments(const yypcontext_t *yyctx, yysymbol_kind_t yyarg[], int yyargn) { /* Actual size of YYARG. */ int yycount = 0; @@ -1388,19 +3138,17 @@ yy_syntax_error_arguments (const yypcontext_t *yyctx, one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ - if (yyctx->yytoken != YYSYMBOL_YYEMPTY) - { - int yyn; - if (yyarg) - yyarg[yycount] = yyctx->yytoken; - ++yycount; - yyn = yypcontext_expected_tokens (yyctx, - yyarg ? yyarg + 1 : yyarg, yyargn - 1); - if (yyn == YYENOMEM) - return YYENOMEM; - else - yycount += yyn; - } + if (yyctx->yytoken != YYSYMBOL_YYEMPTY) { + int yyn; + if (yyarg) + yyarg[yycount] = yyctx->yytoken; + ++yycount; + yyn = yypcontext_expected_tokens(yyctx, yyarg ? yyarg + 1 : yyarg, yyargn - 1); + if (yyn == YYENOMEM) + return YYENOMEM; + else + yycount += yyn; + } return yycount; } @@ -1412,11 +3160,12 @@ yy_syntax_error_arguments (const yypcontext_t *yyctx, not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the required number of bytes is too large to store. */ -static int -yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, - const yypcontext_t *yyctx) +static int yysyntax_error(YYPTRDIFF_T *yymsg_alloc, char **yymsg, const yypcontext_t *yyctx) { - enum { YYARGS_MAX = 5 }; + enum + { + YYARGS_MAX = 5 + }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat: reported tokens (one for the "unexpected", @@ -1426,16 +3175,13 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, YYPTRDIFF_T yysize = 0; /* Actual size of YYARG. */ - int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); + int yycount = yy_syntax_error_arguments(yyctx, yyarg, YYARGS_MAX); if (yycount == YYENOMEM) return YYENOMEM; - switch (yycount) - { -#define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break + switch (yycount) { +#define YYCASE_(N, S) \ + case N: yyformat = S; break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); @@ -1444,134 +3190,118 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); #undef YYCASE_ - } + } /* Compute error message size. Don't count the "%s"s, but reserve room for the terminator. */ - yysize = yystrlen (yyformat) - 2 * yycount + 1; + yysize = yystrlen(yyformat) - 2 * yycount + 1; { int yyi; - for (yyi = 0; yyi < yycount; ++yyi) - { - YYPTRDIFF_T yysize1 - = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return YYENOMEM; - } + for (yyi = 0; yyi < yycount; ++yyi) { + YYPTRDIFF_T yysize1 = yysize + yytnamerr(YY_NULLPTR, yytname[yyarg[yyi]]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return YYENOMEM; + } } - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return -1; - } + if (*yymsg_alloc < yysize) { + *yymsg_alloc = 2 * yysize; + if (!(yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return -1; + } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; - int yyi = 0; + int yyi = 0; while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); - yyformat += 2; - } - else - { - ++yyp; - ++yyformat; - } + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { + yyp += yytnamerr(yyp, yytname[yyarg[yyi++]]); + yyformat += 2; + } else { + ++yyp; + ++yyformat; + } } return 0; } - /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -static void -yydestruct (const char *yymsg, - yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, const char * sql_string, ParsedSqlResult * sql_result, void * scanner) +static void yydestruct(const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, + const char *sql_string, ParsedSqlResult *sql_result, void *scanner) { - YY_USE (yyvaluep); - YY_USE (yylocationp); - YY_USE (sql_string); - YY_USE (sql_result); - YY_USE (scanner); + YY_USE(yyvaluep); + YY_USE(yylocationp); + YY_USE(sql_string); + YY_USE(sql_result); + YY_USE(scanner); if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); + YY_SYMBOL_PRINT(yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YY_USE (yykind); + YY_USE(yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END } - - - - - /*----------. | yyparse. | `----------*/ -int -yyparse (const char * sql_string, ParsedSqlResult * sql_result, void * scanner) +int yyparse(const char *sql_string, ParsedSqlResult *sql_result, void *scanner) { -/* Lookahead token kind. */ -int yychar; - - -/* The semantic value of the lookahead symbol. */ -/* Default value used for initialization, for pacifying older GCCs - or non-GCC compilers. */ -YY_INITIAL_VALUE (static YYSTYPE yyval_default;) -YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); - -/* Location data for the lookahead symbol. */ -static YYLTYPE yyloc_default -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL - = { 1, 1, 1, 1 } -# endif -; -YYLTYPE yylloc = yyloc_default; + /* Lookahead token kind. */ + int yychar; + + /* The semantic value of the lookahead symbol. */ + /* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ + YY_INITIAL_VALUE(static YYSTYPE yyval_default;) + YYSTYPE yylval YY_INITIAL_VALUE(= yyval_default); + + /* Location data for the lookahead symbol. */ + static YYLTYPE yyloc_default +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL + = {1, 1, 1, 1} +#endif + ; + YYLTYPE yylloc = yyloc_default; - /* Number of syntax errors so far. */ - int yynerrs = 0; + /* Number of syntax errors so far. */ + int yynerrs = 0; - yy_state_fast_t yystate = 0; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus = 0; + yy_state_fast_t yystate = 0; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus = 0; - /* Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* Their size. */ - YYPTRDIFF_T yystacksize = YYINITDEPTH; + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; - /* The state stack: array, bottom, top. */ - yy_state_t yyssa[YYINITDEPTH]; - yy_state_t *yyss = yyssa; - yy_state_t *yyssp = yyss; + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; - /* The semantic value stack: array, bottom, top. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp = yyvs; + /* The semantic value stack: array, bottom, top. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; - /* The location stack: array, bottom, top. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp = yyls; + /* The location stack: array, bottom, top. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp = yyls; int yyn; /* The return value of yyparse. */ @@ -1587,24 +3317,23 @@ YYLTYPE yylloc = yyloc_default; YYLTYPE yyerror_range[3]; /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; + char yymsgbuf[128]; + char *yymsg = yymsgbuf; YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; - YYDPRINTF ((stderr, "Starting parse\n")); + YYDPRINTF((stderr, "Starting parse\n")); yychar = YYEMPTY; /* Cause a token to be read. */ yylsp[0] = yylloc; goto yysetstate; - /*------------------------------------------------------------. | yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ @@ -1613,93 +3342,90 @@ YYLTYPE yylloc = yyloc_default; have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - /*--------------------------------------------------------------------. | yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YYDPRINTF((stderr, "Entering state %d\n", yystate)); + YY_ASSERT(0 <= yystate && yystate < YYNSTATES); YY_IGNORE_USELESS_CAST_BEGIN - *yyssp = YY_CAST (yy_state_t, yystate); + *yyssp = YY_CAST(yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END - YY_STACK_PRINT (yyss, yyssp); + YY_STACK_PRINT(yyss, yyssp); if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE YYNOMEM; #else + { + /* Get the current used size of the three stacks, in elements. */ + YYPTRDIFF_T yysize = yyssp - yyss + 1; + +#if defined yyoverflow { - /* Get the current used size of the three stacks, in elements. */ - YYPTRDIFF_T yysize = yyssp - yyss + 1; - -# if defined yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - yy_state_t *yyss1 = yyss; - YYSTYPE *yyvs1 = yyvs; - YYLTYPE *yyls1 = yyls; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * YYSIZEOF (*yyssp), - &yyvs1, yysize * YYSIZEOF (*yyvsp), - &yyls1, yysize * YYSIZEOF (*yylsp), - &yystacksize); - yyss = yyss1; - yyvs = yyvs1; - yyls = yyls1; - } -# else /* defined YYSTACK_RELOCATE */ - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + yy_state_t *yyss1 = yyss; + YYSTYPE *yyvs1 = yyvs; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow(YY_("memory exhausted"), + &yyss1, + yysize * YYSIZEOF(*yyssp), + &yyvs1, + yysize * YYSIZEOF(*yyvsp), + &yyls1, + yysize * YYSIZEOF(*yylsp), + &yystacksize); + yyss = yyss1; + yyvs = yyvs1; + yyls = yyls1; + } +#else /* defined YYSTACK_RELOCATE */ + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + YYNOMEM; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yy_state_t *yyss1 = yyss; + union yyalloc *yyptr = YY_CAST(union yyalloc *, YYSTACK_ALLOC(YY_CAST(YYSIZE_T, YYSTACK_BYTES(yystacksize)))); + if (!yyptr) YYNOMEM; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yy_state_t *yyss1 = yyss; - union yyalloc *yyptr = - YY_CAST (union yyalloc *, - YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); - if (! yyptr) - YYNOMEM; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); - YYSTACK_RELOCATE (yyls_alloc, yyls); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif + YYSTACK_RELOCATE(yyss_alloc, yyss); + YYSTACK_RELOCATE(yyvs_alloc, yyvs); + YYSTACK_RELOCATE(yyls_alloc, yyls); +#undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE(yyss1); + } +#endif - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - yylsp = yyls + yysize - 1; + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; - YY_IGNORE_USELESS_CAST_BEGIN - YYDPRINTF ((stderr, "Stack size increased to %ld\n", - YY_CAST (long, yystacksize))); - YY_IGNORE_USELESS_CAST_END + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF((stderr, "Stack size increased to %ld\n", YY_CAST(long, yystacksize))); + YY_IGNORE_USELESS_CAST_END - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - if (yystate == YYFINAL) YYACCEPT; goto yybackup; - /*-----------. | yybackup. | `-----------*/ @@ -1709,40 +3435,34 @@ YYLTYPE yylloc = yyloc_default; /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) + if (yypact_value_is_default(yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token\n")); - yychar = yylex (&yylval, &yylloc, scanner); - } + if (yychar == YYEMPTY) { + YYDPRINTF((stderr, "Reading a token\n")); + yychar = yylex(&yylval, &yylloc, scanner); + } - if (yychar <= YYEOF) - { - yychar = YYEOF; - yytoken = YYSYMBOL_YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else if (yychar == YYerror) - { - /* The scanner already issued an error message, process directly - to error recovery. But do not keep the error token as - lookahead, it is too special and may lead us to an endless - loop in error recovery. */ - yychar = YYUNDEF; - yytoken = YYSYMBOL_YYerror; - yyerror_range[1] = yylloc; - goto yyerrlab1; - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } + if (yychar <= YYEOF) { + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; + YYDPRINTF((stderr, "Now at end of input.\n")); + } else if (yychar == YYerror) { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + yyerror_range[1] = yylloc; + goto yyerrlab1; + } else { + yytoken = YYTRANSLATE(yychar); + YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc); + } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ @@ -1750,13 +3470,12 @@ YYLTYPE yylloc = yyloc_default; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } + if (yyn <= 0) { + if (yytable_value_is_error(yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } /* Count tokens shifted since error; after three, turn off error status. */ @@ -1764,7 +3483,7 @@ YYLTYPE yylloc = yyloc_default; yyerrstatus--; /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc); yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; @@ -1775,7 +3494,6 @@ YYLTYPE yylloc = yyloc_default; yychar = YYEMPTY; goto yynewstate; - /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ @@ -1785,7 +3503,6 @@ YYLTYPE yylloc = yyloc_default; goto yyerrlab; goto yyreduce; - /*-----------------------------. | yyreduce -- do a reduction. | `-----------------------------*/ @@ -1801,164 +3518,168 @@ YYLTYPE yylloc = yyloc_default; users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; + yyval = yyvsp[1 - yylen]; /* Default location. */ - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YYLLOC_DEFAULT(yyloc, (yylsp - yylen), yylen); yyerror_range[1] = yyloc; - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: /* commands: command_wrapper opt_semicolon */ + YY_REDUCE_PRINT(yyn); + switch (yyn) { + case 2: /* commands: command_wrapper opt_semicolon */ #line 228 "yacc_sql.y" - { - std::unique_ptr sql_node = std::unique_ptr((yyvsp[-1].sql_node)); - sql_result->add_sql_node(std::move(sql_node)); - } + { + std::unique_ptr sql_node = std::unique_ptr((yyvsp[-1].sql_node)); + sql_result->add_sql_node(std::move(sql_node)); + } #line 1819 "yacc_sql.cpp" break; - case 24: /* exit_stmt: EXIT */ + case 24: /* exit_stmt: EXIT */ #line 259 "yacc_sql.y" - { + { (void)yynerrs; // 这么写为了消除yynerrs未使用的告警。如果你有更好的方法欢迎提PR (yyval.sql_node) = new ParsedSqlNode(SCF_EXIT); } #line 1828 "yacc_sql.cpp" break; - case 25: /* help_stmt: HELP */ + case 25: /* help_stmt: HELP */ #line 265 "yacc_sql.y" - { + { (yyval.sql_node) = new ParsedSqlNode(SCF_HELP); } #line 1836 "yacc_sql.cpp" break; - case 26: /* sync_stmt: SYNC */ + case 26: /* sync_stmt: SYNC */ #line 270 "yacc_sql.y" - { + { (yyval.sql_node) = new ParsedSqlNode(SCF_SYNC); } #line 1844 "yacc_sql.cpp" break; - case 27: /* begin_stmt: TRX_BEGIN */ + case 27: /* begin_stmt: TRX_BEGIN */ #line 276 "yacc_sql.y" - { + { (yyval.sql_node) = new ParsedSqlNode(SCF_BEGIN); } #line 1852 "yacc_sql.cpp" break; - case 28: /* commit_stmt: TRX_COMMIT */ + case 28: /* commit_stmt: TRX_COMMIT */ #line 282 "yacc_sql.y" - { + { (yyval.sql_node) = new ParsedSqlNode(SCF_COMMIT); } #line 1860 "yacc_sql.cpp" break; - case 29: /* rollback_stmt: TRX_ROLLBACK */ + case 29: /* rollback_stmt: TRX_ROLLBACK */ #line 288 "yacc_sql.y" - { + { (yyval.sql_node) = new ParsedSqlNode(SCF_ROLLBACK); } #line 1868 "yacc_sql.cpp" break; - case 30: /* drop_table_stmt: DROP TABLE ID */ + case 30: /* drop_table_stmt: DROP TABLE ID */ #line 294 "yacc_sql.y" - { - (yyval.sql_node) = new ParsedSqlNode(SCF_DROP_TABLE); + { + (yyval.sql_node) = new ParsedSqlNode(SCF_DROP_TABLE); (yyval.sql_node)->drop_table.relation_name = (yyvsp[0].string); free((yyvsp[0].string)); } #line 1878 "yacc_sql.cpp" break; - case 31: /* show_tables_stmt: SHOW TABLES */ + case 31: /* show_tables_stmt: SHOW TABLES */ #line 301 "yacc_sql.y" - { + { (yyval.sql_node) = new ParsedSqlNode(SCF_SHOW_TABLES); } #line 1886 "yacc_sql.cpp" break; - case 32: /* desc_table_stmt: DESC ID */ + case 32: /* desc_table_stmt: DESC ID */ #line 307 "yacc_sql.y" - { - (yyval.sql_node) = new ParsedSqlNode(SCF_DESC_TABLE); + { + (yyval.sql_node) = new ParsedSqlNode(SCF_DESC_TABLE); (yyval.sql_node)->desc_table.relation_name = (yyvsp[0].string); free((yyvsp[0].string)); } #line 1896 "yacc_sql.cpp" break; - case 33: /* show_index_stmt: SHOW INDEX FROM relation */ + case 33: /* show_index_stmt: SHOW INDEX FROM relation */ #line 316 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_SHOW_INDEX); + (yyval.sql_node) = new ParsedSqlNode(SCF_SHOW_INDEX); ShowIndexSqlNode &show_index = (yyval.sql_node)->show_index; - show_index.relation_name = (yyvsp[0].string); + show_index.relation_name = (yyvsp[0].string); free((yyvsp[0].string)); } #line 1907 "yacc_sql.cpp" break; - case 34: /* create_index_stmt: CREATE opt_unique INDEX ID ON ID LBRACE attr_list RBRACE */ + case 34: /* create_index_stmt: CREATE opt_unique INDEX ID ON ID LBRACE attr_list RBRACE */ #line 326 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_CREATE_INDEX); + (yyval.sql_node) = new ParsedSqlNode(SCF_CREATE_INDEX); CreateIndexSqlNode &create_index = (yyval.sql_node)->create_index; - create_index.unique = (yyvsp[-7].unique); // 用 opt_unique 的返回值来确定是否 UNIQUE - create_index.index_name = (yyvsp[-5].string); - create_index.relation_name = (yyvsp[-3].string); - create_index.attribute_name.swap(*(yyvsp[-1].index_attr_list)); // $8 是 vector 类型 - delete (yyvsp[-1].index_attr_list); // 释放指针 + create_index.unique = (yyvsp[-7].unique); // 用 opt_unique 的返回值来确定是否 UNIQUE + create_index.index_name = (yyvsp[-5].string); + create_index.relation_name = (yyvsp[-3].string); + create_index.attribute_name.swap(*(yyvsp[-1].index_attr_list)); // $8 是 vector 类型 + delete (yyvsp[-1].index_attr_list); // 释放指针 free((yyvsp[-5].string)); free((yyvsp[-3].string)); } #line 1923 "yacc_sql.cpp" break; - case 35: /* opt_unique: UNIQUE */ + case 35: /* opt_unique: UNIQUE */ #line 340 "yacc_sql.y" - { (yyval.unique) = true; } + { + (yyval.unique) = true; + } #line 1929 "yacc_sql.cpp" break; - case 36: /* opt_unique: %empty */ + case 36: /* opt_unique: %empty */ #line 341 "yacc_sql.y" - { (yyval.unique) = false; } + { + (yyval.unique) = false; + } #line 1935 "yacc_sql.cpp" break; - case 37: /* attr_list: ID */ + case 37: /* attr_list: ID */ #line 346 "yacc_sql.y" { - (yyval.index_attr_list) = new std::vector; // 创建一个新的 vector - (yyval.index_attr_list)->emplace_back((yyvsp[0].string)); // 将列名加入 vector + (yyval.index_attr_list) = new std::vector; // 创建一个新的 vector + (yyval.index_attr_list)->emplace_back((yyvsp[0].string)); // 将列名加入 vector free((yyvsp[0].string)); } #line 1945 "yacc_sql.cpp" break; - case 38: /* attr_list: ID COMMA attr_list */ + case 38: /* attr_list: ID COMMA attr_list */ #line 352 "yacc_sql.y" { - (yyval.index_attr_list) = (yyvsp[0].index_attr_list); // 使用现有的 vector - (yyval.index_attr_list)->emplace((yyval.index_attr_list)->begin(), (yyvsp[-2].string)); // 将新列名加入 vector 开头 + (yyval.index_attr_list) = (yyvsp[0].index_attr_list); // 使用现有的 vector + (yyval.index_attr_list) + ->emplace((yyval.index_attr_list)->begin(), (yyvsp[-2].string)); // 将新列名加入 vector 开头 free((yyvsp[-2].string)); } #line 1955 "yacc_sql.cpp" break; - case 39: /* drop_index_stmt: DROP INDEX ID ON ID */ + case 39: /* drop_index_stmt: DROP INDEX ID ON ID */ #line 361 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_DROP_INDEX); - (yyval.sql_node)->drop_index.index_name = (yyvsp[-2].string); + (yyval.sql_node) = new ParsedSqlNode(SCF_DROP_INDEX); + (yyval.sql_node)->drop_index.index_name = (yyvsp[-2].string); (yyval.sql_node)->drop_index.relation_name = (yyvsp[0].string); free((yyvsp[-2].string)); free((yyvsp[0].string)); @@ -1966,12 +3687,12 @@ YYLTYPE yylloc = yyloc_default; #line 1967 "yacc_sql.cpp" break; - case 40: /* create_table_stmt: CREATE TABLE ID LBRACE attr_def attr_def_list RBRACE storage_format */ + case 40: /* create_table_stmt: CREATE TABLE ID LBRACE attr_def attr_def_list RBRACE storage_format */ #line 371 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_CREATE_TABLE); + (yyval.sql_node) = new ParsedSqlNode(SCF_CREATE_TABLE); CreateTableSqlNode &create_table = (yyval.sql_node)->create_table; - create_table.relation_name = (yyvsp[-5].string); + create_table.relation_name = (yyvsp[-5].string); free((yyvsp[-5].string)); std::vector *src_attrs = (yyvsp[-2].attr_infos); @@ -1991,19 +3712,19 @@ YYLTYPE yylloc = yyloc_default; #line 1992 "yacc_sql.cpp" break; - case 41: /* create_table_stmt: CREATE TABLE ID AS select_stmt */ + case 41: /* create_table_stmt: CREATE TABLE ID AS select_stmt */ #line 392 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_CREATE_TABLE); + (yyval.sql_node) = new ParsedSqlNode(SCF_CREATE_TABLE); CreateTableSqlNode &create_table = (yyval.sql_node)->create_table; - create_table.relation_name = (yyvsp[-2].string); + create_table.relation_name = (yyvsp[-2].string); free((yyvsp[-2].string)); create_table.create_table_select = std::move((yyvsp[0].sql_node)->selection); } #line 2004 "yacc_sql.cpp" break; - case 42: /* attr_def_list: %empty */ + case 42: /* attr_def_list: %empty */ #line 402 "yacc_sql.y" { (yyval.attr_infos) = nullptr; @@ -2011,7 +3732,7 @@ YYLTYPE yylloc = yyloc_default; #line 2012 "yacc_sql.cpp" break; - case 43: /* attr_def_list: COMMA attr_def attr_def_list */ + case 43: /* attr_def_list: COMMA attr_def attr_def_list */ #line 406 "yacc_sql.y" { if ((yyvsp[0].attr_infos) != nullptr) { @@ -2025,13 +3746,13 @@ YYLTYPE yylloc = yyloc_default; #line 2026 "yacc_sql.cpp" break; - case 44: /* attr_def: ID type LBRACE number RBRACE nullable_constraint */ + case 44: /* attr_def: ID type LBRACE number RBRACE nullable_constraint */ #line 419 "yacc_sql.y" { - (yyval.attr_info) = new AttrInfoSqlNode; - (yyval.attr_info)->type = (AttrType)(yyvsp[-4].number); - (yyval.attr_info)->name = (yyvsp[-5].string); - (yyval.attr_info)->length = (yyvsp[-2].number); + (yyval.attr_info) = new AttrInfoSqlNode; + (yyval.attr_info)->type = (AttrType)(yyvsp[-4].number); + (yyval.attr_info)->name = (yyvsp[-5].string); + (yyval.attr_info)->length = (yyvsp[-2].number); (yyval.attr_info)->nullable = (yyvsp[0].nullable_info); if ((yyval.attr_info)->nullable) { (yyval.attr_info)->length++; @@ -2041,10 +3762,10 @@ YYLTYPE yylloc = yyloc_default; #line 2042 "yacc_sql.cpp" break; - case 45: /* attr_def: ID type nullable_constraint */ + case 45: /* attr_def: ID type nullable_constraint */ #line 431 "yacc_sql.y" { - (yyval.attr_info) = new AttrInfoSqlNode; + (yyval.attr_info) = new AttrInfoSqlNode; (yyval.attr_info)->type = (AttrType)(yyvsp[-1].number); (yyval.attr_info)->name = (yyvsp[-2].string); if ((yyval.attr_info)->type == AttrType::INTS) { @@ -2069,7 +3790,7 @@ YYLTYPE yylloc = yyloc_default; #line 2070 "yacc_sql.cpp" break; - case 46: /* nullable_constraint: NOT NULL_T */ + case 46: /* nullable_constraint: NOT NULL_T */ #line 458 "yacc_sql.y" { (yyval.nullable_info) = false; // NOT NULL 对应的可空性为 false @@ -2077,7 +3798,7 @@ YYLTYPE yylloc = yyloc_default; #line 2078 "yacc_sql.cpp" break; - case 47: /* nullable_constraint: NULLABLE */ + case 47: /* nullable_constraint: NULLABLE */ #line 462 "yacc_sql.y" { (yyval.nullable_info) = true; // NULLABLE 对应的可空性为 true 2022 @@ -2085,7 +3806,7 @@ YYLTYPE yylloc = yyloc_default; #line 2086 "yacc_sql.cpp" break; - case 48: /* nullable_constraint: NULL_T */ + case 48: /* nullable_constraint: NULL_T */ #line 466 "yacc_sql.y" { (yyval.nullable_info) = true; // NULL 对应的可空性也为 true 2023 @@ -2093,7 +3814,7 @@ YYLTYPE yylloc = yyloc_default; #line 2094 "yacc_sql.cpp" break; - case 49: /* nullable_constraint: %empty */ + case 49: /* nullable_constraint: %empty */ #line 470 "yacc_sql.y" { (yyval.nullable_info) = true; // 默认情况为 NULL @@ -2101,46 +3822,58 @@ YYLTYPE yylloc = yyloc_default; #line 2102 "yacc_sql.cpp" break; - case 50: /* number: NUMBER */ + case 50: /* number: NUMBER */ #line 476 "yacc_sql.y" - {(yyval.number) = (yyvsp[0].number);} + { + (yyval.number) = (yyvsp[0].number); + } #line 2108 "yacc_sql.cpp" break; - case 51: /* type: INT_T */ + case 51: /* type: INT_T */ #line 480 "yacc_sql.y" - { (yyval.number) = static_cast(AttrType::INTS); } + { + (yyval.number) = static_cast(AttrType::INTS); + } #line 2114 "yacc_sql.cpp" break; - case 52: /* type: STRING_T */ + case 52: /* type: STRING_T */ #line 481 "yacc_sql.y" - { (yyval.number) = static_cast(AttrType::CHARS); } + { + (yyval.number) = static_cast(AttrType::CHARS); + } #line 2120 "yacc_sql.cpp" break; - case 53: /* type: FLOAT_T */ + case 53: /* type: FLOAT_T */ #line 482 "yacc_sql.y" - { (yyval.number) = static_cast(AttrType::FLOATS); } + { + (yyval.number) = static_cast(AttrType::FLOATS); + } #line 2126 "yacc_sql.cpp" break; - case 54: /* type: DATE_T */ + case 54: /* type: DATE_T */ #line 483 "yacc_sql.y" - { (yyval.number) = static_cast(AttrType::DATES); } + { + (yyval.number) = static_cast(AttrType::DATES); + } #line 2132 "yacc_sql.cpp" break; - case 55: /* type: TEXT_T */ + case 55: /* type: TEXT_T */ #line 484 "yacc_sql.y" - { (yyval.number) = static_cast(AttrType::TEXTS); } + { + (yyval.number) = static_cast(AttrType::TEXTS); + } #line 2138 "yacc_sql.cpp" break; - case 56: /* insert_stmt: INSERT INTO ID VALUES values_list */ + case 56: /* insert_stmt: INSERT INTO ID VALUES values_list */ #line 489 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_INSERT); + (yyval.sql_node) = new ParsedSqlNode(SCF_INSERT); (yyval.sql_node)->insertion.relation_name = (yyvsp[-2].string); if ((yyvsp[0].values_list) != nullptr) { (yyval.sql_node)->insertion.values_list.swap(*(yyvsp[0].values_list)); @@ -2151,7 +3884,7 @@ YYLTYPE yylloc = yyloc_default; #line 2152 "yacc_sql.cpp" break; - case 57: /* values_list: LBRACE value_list RBRACE */ + case 57: /* values_list: LBRACE value_list RBRACE */ #line 502 "yacc_sql.y" { (yyval.values_list) = new std::vector>; @@ -2161,7 +3894,7 @@ YYLTYPE yylloc = yyloc_default; #line 2162 "yacc_sql.cpp" break; - case 58: /* values_list: values_list COMMA LBRACE value_list RBRACE */ + case 58: /* values_list: values_list COMMA LBRACE value_list RBRACE */ #line 508 "yacc_sql.y" { (yyval.values_list)->emplace_back(*(yyvsp[-1].value_list)); @@ -2170,7 +3903,7 @@ YYLTYPE yylloc = yyloc_default; #line 2171 "yacc_sql.cpp" break; - case 59: /* value_list: value */ + case 59: /* value_list: value */ #line 515 "yacc_sql.y" { (yyval.value_list) = new std::vector; @@ -2180,7 +3913,7 @@ YYLTYPE yylloc = yyloc_default; #line 2181 "yacc_sql.cpp" break; - case 60: /* value_list: value_list COMMA value */ + case 60: /* value_list: value_list COMMA value */ #line 521 "yacc_sql.y" { (yyval.value_list)->emplace_back(*(yyvsp[0].value)); @@ -2189,28 +3922,28 @@ YYLTYPE yylloc = yyloc_default; #line 2190 "yacc_sql.cpp" break; - case 61: /* value: NUMBER */ + case 61: /* value: NUMBER */ #line 528 "yacc_sql.y" - { + { (yyval.value) = new Value((int)(yyvsp[0].number)); - (yyloc) = (yylsp[0]); + (yyloc) = (yylsp[0]); } #line 2199 "yacc_sql.cpp" break; - case 62: /* value: FLOAT */ + case 62: /* value: FLOAT */ #line 532 "yacc_sql.y" - { + { (yyval.value) = new Value((float)(yyvsp[0].floats)); - (yyloc) = (yylsp[0]); + (yyloc) = (yylsp[0]); } #line 2208 "yacc_sql.cpp" break; - case 63: /* value: SSS */ + case 63: /* value: SSS */ #line 536 "yacc_sql.y" - { - char *tmp = common::substr((yyvsp[0].string),1,strlen((yyvsp[0].string))-2); + { + char *tmp = common::substr((yyvsp[0].string), 1, strlen((yyvsp[0].string)) - 2); (yyval.value) = new Value(tmp); free(tmp); free((yyvsp[0].string)); @@ -2218,15 +3951,15 @@ YYLTYPE yylloc = yyloc_default; #line 2219 "yacc_sql.cpp" break; - case 64: /* value: NULL_T */ + case 64: /* value: NULL_T */ #line 542 "yacc_sql.y" - { + { (yyval.value) = new Value(NullValue()); } #line 2227 "yacc_sql.cpp" break; - case 65: /* storage_format: %empty */ + case 65: /* storage_format: %empty */ #line 549 "yacc_sql.y" { (yyval.string) = nullptr; @@ -2234,7 +3967,7 @@ YYLTYPE yylloc = yyloc_default; #line 2235 "yacc_sql.cpp" break; - case 66: /* storage_format: STORAGE FORMAT EQ ID */ + case 66: /* storage_format: STORAGE FORMAT EQ ID */ #line 553 "yacc_sql.y" { (yyval.string) = (yyvsp[0].string); @@ -2242,10 +3975,10 @@ YYLTYPE yylloc = yyloc_default; #line 2243 "yacc_sql.cpp" break; - case 67: /* delete_stmt: DELETE FROM ID where */ + case 67: /* delete_stmt: DELETE FROM ID where */ #line 560 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_DELETE); + (yyval.sql_node) = new ParsedSqlNode(SCF_DELETE); (yyval.sql_node)->deletion.relation_name = (yyvsp[-1].string); if ((yyvsp[0].expression) != nullptr) { (yyval.sql_node)->deletion.condition = std::unique_ptr((yyvsp[0].expression)); @@ -2255,10 +3988,10 @@ YYLTYPE yylloc = yyloc_default; #line 2256 "yacc_sql.cpp" break; - case 68: /* update_stmt: UPDATE ID SET setClauses where */ + case 68: /* update_stmt: UPDATE ID SET setClauses where */ #line 572 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_UPDATE); + (yyval.sql_node) = new ParsedSqlNode(SCF_UPDATE); (yyval.sql_node)->update.relation_name = (yyvsp[-3].string); (yyval.sql_node)->update.set_clauses.swap(*(yyvsp[-1].set_clauses)); if ((yyvsp[0].expression) != nullptr) { @@ -2270,7 +4003,7 @@ YYLTYPE yylloc = yyloc_default; #line 2271 "yacc_sql.cpp" break; - case 69: /* setClauses: setClause */ + case 69: /* setClauses: setClause */ #line 586 "yacc_sql.y" { (yyval.set_clauses) = new std::vector; @@ -2279,7 +4012,7 @@ YYLTYPE yylloc = yyloc_default; #line 2280 "yacc_sql.cpp" break; - case 70: /* setClauses: setClauses COMMA setClause */ + case 70: /* setClauses: setClauses COMMA setClause */ #line 591 "yacc_sql.y" { (yyval.set_clauses)->emplace_back(std::move(*(yyvsp[0].set_clause))); @@ -2287,18 +4020,18 @@ YYLTYPE yylloc = yyloc_default; #line 2288 "yacc_sql.cpp" break; - case 71: /* setClause: ID EQ expression */ + case 71: /* setClause: ID EQ expression */ #line 598 "yacc_sql.y" { - (yyval.set_clause) = new SetClauseSqlNode; + (yyval.set_clause) = new SetClauseSqlNode; (yyval.set_clause)->field_name = (yyvsp[-2].string); - (yyval.set_clause)->value = std::unique_ptr((yyvsp[0].expression)); + (yyval.set_clause)->value = std::unique_ptr((yyvsp[0].expression)); free((yyvsp[-2].string)); } #line 2299 "yacc_sql.cpp" break; - case 72: /* select_stmt: SELECT expression_list FROM rel_list where group_by opt_order_by */ + case 72: /* select_stmt: SELECT expression_list FROM rel_list where group_by opt_order_by */ #line 608 "yacc_sql.y" { (yyval.sql_node) = new ParsedSqlNode(SCF_SELECT); @@ -2331,7 +4064,7 @@ YYLTYPE yylloc = yyloc_default; #line 2332 "yacc_sql.cpp" break; - case 73: /* select_stmt: SELECT expression_list FROM relation INNER JOIN joinClauses where group_by */ + case 73: /* select_stmt: SELECT expression_list FROM relation INNER JOIN joinClauses where group_by */ #line 637 "yacc_sql.y" { (yyval.sql_node) = new ParsedSqlNode(SCF_SELECT); @@ -2346,7 +4079,8 @@ YYLTYPE yylloc = yyloc_default; } if ((yyvsp[-2].join_clauses) != nullptr) { - for (auto it = (yyvsp[-2].join_clauses)->relations.rbegin(); it != (yyvsp[-2].join_clauses)->relations.rend(); ++it) { + for (auto it = (yyvsp[-2].join_clauses)->relations.rbegin(); it != (yyvsp[-2].join_clauses)->relations.rend(); + ++it) { (yyval.sql_node)->selection.relations.emplace_back(std::move(*it)); } (yyval.sql_node)->selection.conditions = std::move((yyvsp[-2].join_clauses)->conditions); @@ -2354,7 +4088,8 @@ YYLTYPE yylloc = yyloc_default; if ((yyvsp[-1].expression) != nullptr) { auto ptr = (yyval.sql_node)->selection.conditions.release(); - (yyval.sql_node)->selection.conditions = std::make_unique(ConjunctionExpr::Type::AND, ptr, (yyvsp[-1].expression)); + (yyval.sql_node)->selection.conditions = + std::make_unique(ConjunctionExpr::Type::AND, ptr, (yyvsp[-1].expression)); } if ((yyvsp[0].expression_list) != nullptr) { @@ -2365,7 +4100,7 @@ YYLTYPE yylloc = yyloc_default; #line 2366 "yacc_sql.cpp" break; - case 74: /* calc_stmt: CALC expression_list */ + case 74: /* calc_stmt: CALC expression_list */ #line 670 "yacc_sql.y" { (yyval.sql_node) = new ParsedSqlNode(SCF_CALC); @@ -2375,7 +4110,7 @@ YYLTYPE yylloc = yyloc_default; #line 2376 "yacc_sql.cpp" break; - case 75: /* calc_stmt: SELECT expression_list */ + case 75: /* calc_stmt: SELECT expression_list */ #line 676 "yacc_sql.y" { (yyval.sql_node) = new ParsedSqlNode(SCF_CALC); @@ -2385,15 +4120,15 @@ YYLTYPE yylloc = yyloc_default; #line 2386 "yacc_sql.cpp" break; - case 76: /* expression_list: %empty */ + case 76: /* expression_list: %empty */ #line 684 "yacc_sql.y" - { + { (yyval.expression_list) = new std::vector>; } #line 2394 "yacc_sql.cpp" break; - case 77: /* expression_list: expression alias */ + case 77: /* expression_list: expression alias */ #line 688 "yacc_sql.y" { (yyval.expression_list) = new std::vector>; @@ -2406,7 +4141,7 @@ YYLTYPE yylloc = yyloc_default; #line 2407 "yacc_sql.cpp" break; - case 78: /* expression_list: expression alias COMMA expression_list */ + case 78: /* expression_list: expression alias COMMA expression_list */ #line 697 "yacc_sql.y" { if ((yyvsp[0].expression_list) != nullptr) { @@ -2417,47 +4152,51 @@ YYLTYPE yylloc = yyloc_default; if (nullptr != (yyvsp[-2].string)) { (yyvsp[-3].expression)->set_name((yyvsp[-2].string)); } - (yyval.expression_list)->emplace((yyval.expression_list)->begin(),std::move((yyvsp[-3].expression))); + (yyval.expression_list)->emplace((yyval.expression_list)->begin(), std::move((yyvsp[-3].expression))); free((yyvsp[-2].string)); } #line 2424 "yacc_sql.cpp" break; - case 79: /* expression: expression '+' expression */ + case 79: /* expression: expression '+' expression */ #line 712 "yacc_sql.y" - { - (yyval.expression) = create_arithmetic_expression(ArithmeticExpr::Type::ADD, (yyvsp[-2].expression), (yyvsp[0].expression), sql_string, &(yyloc)); + { + (yyval.expression) = create_arithmetic_expression( + ArithmeticExpr::Type::ADD, (yyvsp[-2].expression), (yyvsp[0].expression), sql_string, &(yyloc)); } #line 2432 "yacc_sql.cpp" break; - case 80: /* expression: expression '-' expression */ + case 80: /* expression: expression '-' expression */ #line 715 "yacc_sql.y" - { - (yyval.expression) = create_arithmetic_expression(ArithmeticExpr::Type::SUB, (yyvsp[-2].expression), (yyvsp[0].expression), sql_string, &(yyloc)); + { + (yyval.expression) = create_arithmetic_expression( + ArithmeticExpr::Type::SUB, (yyvsp[-2].expression), (yyvsp[0].expression), sql_string, &(yyloc)); } #line 2440 "yacc_sql.cpp" break; - case 81: /* expression: expression '*' expression */ + case 81: /* expression: expression '*' expression */ #line 718 "yacc_sql.y" - { - (yyval.expression) = create_arithmetic_expression(ArithmeticExpr::Type::MUL, (yyvsp[-2].expression), (yyvsp[0].expression), sql_string, &(yyloc)); + { + (yyval.expression) = create_arithmetic_expression( + ArithmeticExpr::Type::MUL, (yyvsp[-2].expression), (yyvsp[0].expression), sql_string, &(yyloc)); } #line 2448 "yacc_sql.cpp" break; - case 82: /* expression: expression '/' expression */ + case 82: /* expression: expression '/' expression */ #line 721 "yacc_sql.y" - { - (yyval.expression) = create_arithmetic_expression(ArithmeticExpr::Type::DIV, (yyvsp[-2].expression), (yyvsp[0].expression), sql_string, &(yyloc)); + { + (yyval.expression) = create_arithmetic_expression( + ArithmeticExpr::Type::DIV, (yyvsp[-2].expression), (yyvsp[0].expression), sql_string, &(yyloc)); } #line 2456 "yacc_sql.cpp" break; - case 83: /* expression: LBRACE expression_list RBRACE */ + case 83: /* expression: LBRACE expression_list RBRACE */ #line 724 "yacc_sql.y" - { + { if ((yyvsp[-1].expression_list)->size() == 1) { (yyval.expression) = (yyvsp[-1].expression_list)->front().get(); } else { @@ -2469,17 +4208,18 @@ YYLTYPE yylloc = yyloc_default; #line 2470 "yacc_sql.cpp" break; - case 84: /* expression: '-' expression */ + case 84: /* expression: '-' expression */ #line 733 "yacc_sql.y" - { - (yyval.expression) = create_arithmetic_expression(ArithmeticExpr::Type::NEGATIVE, (yyvsp[0].expression), nullptr, sql_string, &(yyloc)); + { + (yyval.expression) = create_arithmetic_expression( + ArithmeticExpr::Type::NEGATIVE, (yyvsp[0].expression), nullptr, sql_string, &(yyloc)); } #line 2478 "yacc_sql.cpp" break; - case 85: /* expression: value */ + case 85: /* expression: value */ #line 736 "yacc_sql.y" - { + { (yyval.expression) = new ValueExpr(*(yyvsp[0].value)); (yyval.expression)->set_name(token_name(sql_string, &(yyloc))); delete (yyvsp[0].value); @@ -2487,74 +4227,74 @@ YYLTYPE yylloc = yyloc_default; #line 2488 "yacc_sql.cpp" break; - case 86: /* expression: rel_attr */ + case 86: /* expression: rel_attr */ #line 741 "yacc_sql.y" - { + { RelAttrSqlNode *node = (yyvsp[0].rel_attr); - (yyval.expression) = new UnboundFieldExpr(node->relation_name, node->attribute_name); + (yyval.expression) = new UnboundFieldExpr(node->relation_name, node->attribute_name); (yyval.expression)->set_name(token_name(sql_string, &(yyloc))); delete (yyvsp[0].rel_attr); } #line 2499 "yacc_sql.cpp" break; - case 87: /* expression: '*' */ + case 87: /* expression: '*' */ #line 747 "yacc_sql.y" - { + { (yyval.expression) = new StarExpr(); } #line 2507 "yacc_sql.cpp" break; - case 88: /* expression: aggr_func_expr */ + case 88: /* expression: aggr_func_expr */ #line 750 "yacc_sql.y" - { - (yyval.expression) = (yyvsp[0].expression); // AggrFuncExpr + { + (yyval.expression) = (yyvsp[0].expression); // AggrFuncExpr } #line 2515 "yacc_sql.cpp" break; - case 89: /* expression: sub_query_expr */ + case 89: /* expression: sub_query_expr */ #line 753 "yacc_sql.y" - { - (yyval.expression) = (yyvsp[0].expression); // SubQueryExpr + { + (yyval.expression) = (yyvsp[0].expression); // SubQueryExpr } #line 2523 "yacc_sql.cpp" break; - case 90: /* alias: %empty */ + case 90: /* alias: %empty */ #line 760 "yacc_sql.y" - { + { (yyval.string) = nullptr; } #line 2531 "yacc_sql.cpp" break; - case 91: /* alias: ID */ + case 91: /* alias: ID */ #line 763 "yacc_sql.y" - { + { (yyval.string) = (yyvsp[0].string); } #line 2539 "yacc_sql.cpp" break; - case 92: /* alias: AS ID */ + case 92: /* alias: AS ID */ #line 766 "yacc_sql.y" - { + { (yyval.string) = (yyvsp[0].string); } #line 2547 "yacc_sql.cpp" break; - case 93: /* aggr_func_expr: ID LBRACE expression_list RBRACE */ + case 93: /* aggr_func_expr: ID LBRACE expression_list RBRACE */ #line 772 "yacc_sql.y" { - (yyval.expression) = new UnboundFunctionExpr((yyvsp[-3].string), std::move(*(yyvsp[-1].expression_list))); + (yyval.expression) = new UnboundFunctionExpr((yyvsp[-3].string), std::move(*(yyvsp[-1].expression_list))); } #line 2555 "yacc_sql.cpp" break; - case 94: /* sub_query_expr: LBRACE select_stmt RBRACE */ + case 94: /* sub_query_expr: LBRACE select_stmt RBRACE */ #line 779 "yacc_sql.y" { (yyval.expression) = new SubQueryExpr((yyvsp[-1].sql_node)->selection); @@ -2562,20 +4302,20 @@ YYLTYPE yylloc = yyloc_default; #line 2563 "yacc_sql.cpp" break; - case 95: /* rel_attr: ID */ + case 95: /* rel_attr: ID */ #line 785 "yacc_sql.y" - { - (yyval.rel_attr) = new RelAttrSqlNode; + { + (yyval.rel_attr) = new RelAttrSqlNode; (yyval.rel_attr)->attribute_name = (yyvsp[0].string); free((yyvsp[0].string)); } #line 2573 "yacc_sql.cpp" break; - case 96: /* rel_attr: ID DOT ID */ + case 96: /* rel_attr: ID DOT ID */ #line 790 "yacc_sql.y" - { - (yyval.rel_attr) = new RelAttrSqlNode; + { + (yyval.rel_attr) = new RelAttrSqlNode; (yyval.rel_attr)->relation_name = (yyvsp[-2].string); (yyval.rel_attr)->attribute_name = (yyvsp[0].string); free((yyvsp[-2].string)); @@ -2584,22 +4324,22 @@ YYLTYPE yylloc = yyloc_default; #line 2585 "yacc_sql.cpp" break; - case 97: /* relation: ID */ + case 97: /* relation: ID */ #line 800 "yacc_sql.y" - { + { (yyval.string) = (yyvsp[0].string); } #line 2593 "yacc_sql.cpp" break; - case 98: /* rel_list: relation alias */ + case 98: /* rel_list: relation alias */ #line 806 "yacc_sql.y" - { + { (yyval.relation_list) = new std::vector(); - if(nullptr!=(yyvsp[0].string)){ - (yyval.relation_list)->emplace_back((yyvsp[-1].string),(yyvsp[0].string)); + if (nullptr != (yyvsp[0].string)) { + (yyval.relation_list)->emplace_back((yyvsp[-1].string), (yyvsp[0].string)); free((yyvsp[0].string)); - }else{ + } else { (yyval.relation_list)->emplace_back((yyvsp[-1].string)); } free((yyvsp[-1].string)); @@ -2607,18 +4347,19 @@ YYLTYPE yylloc = yyloc_default; #line 2608 "yacc_sql.cpp" break; - case 99: /* rel_list: relation alias COMMA rel_list */ + case 99: /* rel_list: relation alias COMMA rel_list */ #line 816 "yacc_sql.y" - { + { if ((yyvsp[0].relation_list) != nullptr) { (yyval.relation_list) = (yyvsp[0].relation_list); } else { (yyval.relation_list) = new std::vector; } - if(nullptr!=(yyvsp[-2].string)){ - (yyval.relation_list)->insert((yyval.relation_list)->begin(), RelationNode((yyvsp[-3].string),(yyvsp[-2].string))); + if (nullptr != (yyvsp[-2].string)) { + (yyval.relation_list) + ->insert((yyval.relation_list)->begin(), RelationNode((yyvsp[-3].string), (yyvsp[-2].string))); free((yyvsp[-2].string)); - }else{ + } else { (yyval.relation_list)->insert((yyval.relation_list)->begin(), RelationNode((yyvsp[-3].string))); } free((yyvsp[-3].string)); @@ -2626,7 +4367,7 @@ YYLTYPE yylloc = yyloc_default; #line 2627 "yacc_sql.cpp" break; - case 100: /* joinClauses: relation ON condition */ + case 100: /* joinClauses: relation ON condition */ #line 834 "yacc_sql.y" { (yyval.join_clauses) = new JoinSqlNode; @@ -2637,19 +4378,20 @@ YYLTYPE yylloc = yyloc_default; #line 2638 "yacc_sql.cpp" break; - case 101: /* joinClauses: relation ON condition INNER JOIN joinClauses */ + case 101: /* joinClauses: relation ON condition INNER JOIN joinClauses */ #line 841 "yacc_sql.y" { (yyval.join_clauses) = (yyvsp[0].join_clauses); (yyval.join_clauses)->relations.emplace_back((yyvsp[-5].string)); auto ptr = (yyval.join_clauses)->conditions.release(); - (yyval.join_clauses)->conditions = std::make_unique(ConjunctionExpr::Type::AND, ptr, (yyvsp[-3].expression)); + (yyval.join_clauses)->conditions = + std::make_unique(ConjunctionExpr::Type::AND, ptr, (yyvsp[-3].expression)); free((yyvsp[-5].string)); } #line 2650 "yacc_sql.cpp" break; - case 102: /* where: %empty */ + case 102: /* where: %empty */ #line 852 "yacc_sql.y" { (yyval.expression) = nullptr; @@ -2657,15 +4399,15 @@ YYLTYPE yylloc = yyloc_default; #line 2658 "yacc_sql.cpp" break; - case 103: /* where: WHERE condition */ + case 103: /* where: WHERE condition */ #line 855 "yacc_sql.y" - { - (yyval.expression) = (yyvsp[0].expression); + { + (yyval.expression) = (yyvsp[0].expression); } #line 2666 "yacc_sql.cpp" break; - case 104: /* condition: expression comp_op expression */ + case 104: /* condition: expression comp_op expression */ #line 862 "yacc_sql.y" { (yyval.expression) = new ComparisonExpr((yyvsp[-1].comp), (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -2673,95 +4415,121 @@ YYLTYPE yylloc = yyloc_default; #line 2674 "yacc_sql.cpp" break; - case 105: /* condition: condition AND condition */ + case 105: /* condition: condition AND condition */ #line 866 "yacc_sql.y" { - (yyval.expression) = new ConjunctionExpr(ConjunctionExpr::Type::AND, (yyvsp[-2].expression), (yyvsp[0].expression)); + (yyval.expression) = + new ConjunctionExpr(ConjunctionExpr::Type::AND, (yyvsp[-2].expression), (yyvsp[0].expression)); } #line 2682 "yacc_sql.cpp" break; - case 106: /* condition: condition OR condition */ + case 106: /* condition: condition OR condition */ #line 870 "yacc_sql.y" { - (yyval.expression) = new ConjunctionExpr(ConjunctionExpr::Type::OR, (yyvsp[-2].expression), (yyvsp[0].expression)); + (yyval.expression) = + new ConjunctionExpr(ConjunctionExpr::Type::OR, (yyvsp[-2].expression), (yyvsp[0].expression)); } #line 2690 "yacc_sql.cpp" break; - case 107: /* comp_op: EQ */ + case 107: /* comp_op: EQ */ #line 876 "yacc_sql.y" - { (yyval.comp) = EQUAL_TO; } + { + (yyval.comp) = EQUAL_TO; + } #line 2696 "yacc_sql.cpp" break; - case 108: /* comp_op: LT */ + case 108: /* comp_op: LT */ #line 877 "yacc_sql.y" - { (yyval.comp) = LESS_THAN; } + { + (yyval.comp) = LESS_THAN; + } #line 2702 "yacc_sql.cpp" break; - case 109: /* comp_op: GT */ + case 109: /* comp_op: GT */ #line 878 "yacc_sql.y" - { (yyval.comp) = GREAT_THAN; } + { + (yyval.comp) = GREAT_THAN; + } #line 2708 "yacc_sql.cpp" break; - case 110: /* comp_op: LE */ + case 110: /* comp_op: LE */ #line 879 "yacc_sql.y" - { (yyval.comp) = LESS_EQUAL; } + { + (yyval.comp) = LESS_EQUAL; + } #line 2714 "yacc_sql.cpp" break; - case 111: /* comp_op: GE */ + case 111: /* comp_op: GE */ #line 880 "yacc_sql.y" - { (yyval.comp) = GREAT_EQUAL; } + { + (yyval.comp) = GREAT_EQUAL; + } #line 2720 "yacc_sql.cpp" break; - case 112: /* comp_op: NE */ + case 112: /* comp_op: NE */ #line 881 "yacc_sql.y" - { (yyval.comp) = NOT_EQUAL; } + { + (yyval.comp) = NOT_EQUAL; + } #line 2726 "yacc_sql.cpp" break; - case 113: /* comp_op: IS */ + case 113: /* comp_op: IS */ #line 882 "yacc_sql.y" - { (yyval.comp) = IS_OP; } + { + (yyval.comp) = IS_OP; + } #line 2732 "yacc_sql.cpp" break; - case 114: /* comp_op: IS NOT */ + case 114: /* comp_op: IS NOT */ #line 883 "yacc_sql.y" - { (yyval.comp) = IS_NOT_OP; } + { + (yyval.comp) = IS_NOT_OP; + } #line 2738 "yacc_sql.cpp" break; - case 115: /* comp_op: LIKE */ + case 115: /* comp_op: LIKE */ #line 884 "yacc_sql.y" - { (yyval.comp) = LIKE_OP;} + { + (yyval.comp) = LIKE_OP; + } #line 2744 "yacc_sql.cpp" break; - case 116: /* comp_op: NOT LIKE */ + case 116: /* comp_op: NOT LIKE */ #line 885 "yacc_sql.y" - {(yyval.comp) = NOT_LIKE_OP;} + { + (yyval.comp) = NOT_LIKE_OP; + } #line 2750 "yacc_sql.cpp" break; - case 117: /* comp_op: IN */ + case 117: /* comp_op: IN */ #line 886 "yacc_sql.y" - { (yyval.comp) = IN_OP; } + { + (yyval.comp) = IN_OP; + } #line 2756 "yacc_sql.cpp" break; - case 118: /* comp_op: NOT IN */ + case 118: /* comp_op: NOT IN */ #line 887 "yacc_sql.y" - { (yyval.comp) = NOT_IN_OP; } + { + (yyval.comp) = NOT_IN_OP; + } #line 2762 "yacc_sql.cpp" break; - case 119: /* opt_order_by: %empty */ + case 119: /* opt_order_by: %empty */ #line 892 "yacc_sql.y" { (yyval.orderby_list) = nullptr; @@ -2769,64 +4537,64 @@ YYLTYPE yylloc = yyloc_default; #line 2770 "yacc_sql.cpp" break; - case 120: /* opt_order_by: ORDER BY sort_list */ + case 120: /* opt_order_by: ORDER BY sort_list */ #line 896 "yacc_sql.y" { (yyval.orderby_list) = (yyvsp[0].orderby_list); - std::reverse((yyval.orderby_list)->begin(),(yyval.orderby_list)->end()); + std::reverse((yyval.orderby_list)->begin(), (yyval.orderby_list)->end()); } #line 2779 "yacc_sql.cpp" break; - case 121: /* sort_list: sort_unit */ + case 121: /* sort_list: sort_unit */ #line 904 "yacc_sql.y" - { + { (yyval.orderby_list) = new std::vector; (yyval.orderby_list)->emplace_back(std::move(*(yyvsp[0].orderby_unit))); - } + } #line 2788 "yacc_sql.cpp" break; - case 122: /* sort_list: sort_unit COMMA sort_list */ + case 122: /* sort_list: sort_unit COMMA sort_list */ #line 909 "yacc_sql.y" - { + { (yyvsp[0].orderby_list)->emplace_back(std::move(*(yyvsp[-2].orderby_unit))); (yyval.orderby_list) = (yyvsp[0].orderby_list); - } + } #line 2797 "yacc_sql.cpp" break; - case 123: /* sort_unit: expression */ + case 123: /* sort_unit: expression */ #line 917 "yacc_sql.y" - { - (yyval.orderby_unit) = new OrderBySqlNode(); - (yyval.orderby_unit)->expr = std::unique_ptr((yyvsp[0].expression)); + { + (yyval.orderby_unit) = new OrderBySqlNode(); + (yyval.orderby_unit)->expr = std::unique_ptr((yyvsp[0].expression)); (yyval.orderby_unit)->is_asc = true; - } + } #line 2807 "yacc_sql.cpp" break; - case 124: /* sort_unit: expression DESC */ + case 124: /* sort_unit: expression DESC */ #line 923 "yacc_sql.y" - { - (yyval.orderby_unit) = new OrderBySqlNode(); - (yyval.orderby_unit)->expr = std::unique_ptr((yyvsp[-1].expression)); + { + (yyval.orderby_unit) = new OrderBySqlNode(); + (yyval.orderby_unit)->expr = std::unique_ptr((yyvsp[-1].expression)); (yyval.orderby_unit)->is_asc = false; - } + } #line 2817 "yacc_sql.cpp" break; - case 125: /* sort_unit: expression ASC */ + case 125: /* sort_unit: expression ASC */ #line 929 "yacc_sql.y" - { - (yyval.orderby_unit) = new OrderBySqlNode(); // 默认是升序 - (yyval.orderby_unit)->expr = std::unique_ptr((yyvsp[-1].expression)); + { + (yyval.orderby_unit) = new OrderBySqlNode(); // 默认是升序 + (yyval.orderby_unit)->expr = std::unique_ptr((yyvsp[-1].expression)); (yyval.orderby_unit)->is_asc = true; - } + } #line 2827 "yacc_sql.cpp" break; - case 126: /* group_by: %empty */ + case 126: /* group_by: %empty */ #line 938 "yacc_sql.y" { (yyval.expression_list) = nullptr; @@ -2834,33 +4602,33 @@ YYLTYPE yylloc = yyloc_default; #line 2835 "yacc_sql.cpp" break; - case 127: /* load_data_stmt: LOAD DATA INFILE SSS INTO TABLE ID */ + case 127: /* load_data_stmt: LOAD DATA INFILE SSS INTO TABLE ID */ #line 944 "yacc_sql.y" { char *tmp_file_name = common::substr((yyvsp[-3].string), 1, strlen((yyvsp[-3].string)) - 2); - - (yyval.sql_node) = new ParsedSqlNode(SCF_LOAD_DATA); + + (yyval.sql_node) = new ParsedSqlNode(SCF_LOAD_DATA); (yyval.sql_node)->load_data.relation_name = (yyvsp[0].string); - (yyval.sql_node)->load_data.file_name = tmp_file_name; + (yyval.sql_node)->load_data.file_name = tmp_file_name; free((yyvsp[0].string)); free(tmp_file_name); } #line 2849 "yacc_sql.cpp" break; - case 128: /* explain_stmt: EXPLAIN command_wrapper */ + case 128: /* explain_stmt: EXPLAIN command_wrapper */ #line 957 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_EXPLAIN); + (yyval.sql_node) = new ParsedSqlNode(SCF_EXPLAIN); (yyval.sql_node)->explain.sql_node = std::unique_ptr((yyvsp[0].sql_node)); } #line 2858 "yacc_sql.cpp" break; - case 129: /* set_variable_stmt: SET ID EQ value */ + case 129: /* set_variable_stmt: SET ID EQ value */ #line 965 "yacc_sql.y" { - (yyval.sql_node) = new ParsedSqlNode(SCF_SET_VARIABLE); + (yyval.sql_node) = new ParsedSqlNode(SCF_SET_VARIABLE); (yyval.sql_node)->set_variable.name = (yyvsp[-2].string); (yyval.sql_node)->set_variable.value = *(yyvsp[0].value); free((yyvsp[-2].string)); @@ -2869,11 +4637,10 @@ YYLTYPE yylloc = yyloc_default; #line 2870 "yacc_sql.cpp" break; - #line 2874 "yacc_sql.cpp" - default: break; - } + default: break; + } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. @@ -2885,9 +4652,9 @@ YYLTYPE yylloc = yyloc_default; case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); + YY_SYMBOL_PRINT("-> $$ =", YY_CAST(yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); - YYPOPSTACK (yylen); + YYPOPSTACK(yylen); yylen = 0; *++yyvsp = yyval; @@ -2898,84 +4665,67 @@ YYLTYPE yylloc = yyloc_default; number reduced by. */ { const int yylhs = yyr1[yyn] - YYNTOKENS; - const int yyi = yypgoto[yylhs] + *yyssp; - yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp - ? yytable[yyi] - : yydefgoto[yylhs]); + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp ? yytable[yyi] : yydefgoto[yylhs]); } goto yynewstate; - /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE(yychar); /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; - { - yypcontext_t yyctx - = {yyssp, yytoken, &yylloc}; - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == -1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = YY_CAST (char *, - YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); - if (yymsg) - { - yysyntax_error_status - = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); - yymsgp = yymsg; - } - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = YYENOMEM; - } - } - yyerror (&yylloc, sql_string, sql_result, scanner, yymsgp); - if (yysyntax_error_status == YYENOMEM) - YYNOMEM; + if (!yyerrstatus) { + ++yynerrs; + { + yypcontext_t yyctx = {yyssp, yytoken, &yylloc}; + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = yysyntax_error(&yymsg_alloc, &yymsg, &yyctx); + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == -1) { + if (yymsg != yymsgbuf) + YYSTACK_FREE(yymsg); + yymsg = YY_CAST(char *, YYSTACK_ALLOC(YY_CAST(YYSIZE_T, yymsg_alloc))); + if (yymsg) { + yysyntax_error_status = yysyntax_error(&yymsg_alloc, &yymsg, &yyctx); + yymsgp = yymsg; + } else { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = YYENOMEM; + } } + yyerror(&yylloc, sql_string, sql_result, scanner, yymsgp); + if (yysyntax_error_status == YYENOMEM) + YYNOMEM; } + } yyerror_range[1] = yylloc; - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + if (yyerrstatus == 3) { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval, &yylloc, sql_string, sql_result, scanner); - yychar = YYEMPTY; - } + if (yychar <= YYEOF) { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else { + yydestruct("Error: discarding", yytoken, &yylval, &yylloc, sql_string, sql_result, scanner); + yychar = YYEMPTY; } + } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; - /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ @@ -2988,45 +4738,40 @@ YYLTYPE yylloc = yyloc_default; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ - YYPOPSTACK (yylen); + YYPOPSTACK(yylen); yylen = 0; - YY_STACK_PRINT (yyss, yyssp); + YY_STACK_PRINT(yyss, yyssp); yystate = *yyssp; goto yyerrlab1; - /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ /* Pop stack until we find a state that shifts the error token. */ - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYSYMBOL_YYerror; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + for (;;) { + yyn = yypact[yystate]; + if (!yypact_value_is_default(yyn)) { + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yyerror_range[1] = *yylsp; - yydestruct ("Error: popping", - YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp, sql_string, sql_result, scanner); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } + yyerror_range[1] = *yylsp; + yydestruct("Error: popping", YY_ACCESSING_SYMBOL(yystate), yyvsp, yylsp, sql_string, sql_result, scanner); + YYPOPSTACK(1); + yystate = *yyssp; + YY_STACK_PRINT(yyss, yyssp); + } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; @@ -3034,15 +4779,14 @@ YYLTYPE yylloc = yyloc_default; yyerror_range[2] = yylloc; ++yylsp; - YYLLOC_DEFAULT (*yylsp, yyerror_range, 2); + YYLLOC_DEFAULT(*yylsp, yyerror_range, 2); /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); + YY_SYMBOL_PRINT("Shifting", YY_ACCESSING_SYMBOL(yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; - /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ @@ -3050,7 +4794,6 @@ YYLTYPE yylloc = yyloc_default; yyresult = 0; goto yyreturnlab; - /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -3058,44 +4801,38 @@ YYLTYPE yylloc = yyloc_default; yyresult = 1; goto yyreturnlab; - /*-----------------------------------------------------------. | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | `-----------------------------------------------------------*/ yyexhaustedlab: - yyerror (&yylloc, sql_string, sql_result, scanner, YY_("memory exhausted")); + yyerror(&yylloc, sql_string, sql_result, scanner, YY_("memory exhausted")); yyresult = 2; goto yyreturnlab; - /*----------------------------------------------------------. | yyreturnlab -- parsing is finished, clean up and return. | `----------------------------------------------------------*/ yyreturnlab: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, &yylloc, sql_string, sql_result, scanner); - } + if (yychar != YYEMPTY) { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE(yychar); + yydestruct("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, sql_string, sql_result, scanner); + } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp, sql_string, sql_result, scanner); - YYPOPSTACK (1); - } + YYPOPSTACK(yylen); + YY_STACK_PRINT(yyss, yyssp); + while (yyssp != yyss) { + yydestruct("Cleanup: popping", YY_ACCESSING_SYMBOL(+*yyssp), yyvsp, yylsp, sql_string, sql_result, scanner); + YYPOPSTACK(1); + } #ifndef yyoverflow if (yyss != yyssa) - YYSTACK_FREE (yyss); + YYSTACK_FREE(yyss); #endif if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); + YYSTACK_FREE(yymsg); return yyresult; } @@ -3104,7 +4841,8 @@ YYLTYPE yylloc = yyloc_default; //_____________________________________________________________________ extern void scan_string(const char *str, yyscan_t scanner); -int sql_parse(const char *s, ParsedSqlResult *sql_result) { +int sql_parse(const char *s, ParsedSqlResult *sql_result) +{ yyscan_t scanner; yylex_init(&scanner); scan_string(s, scanner); diff --git a/src/observer/sql/parser/yacc_sql.hpp b/src/observer/sql/parser/yacc_sql.hpp index d624214f..c6c8b3e2 100644 --- a/src/observer/sql/parser/yacc_sql.hpp +++ b/src/observer/sql/parser/yacc_sql.hpp @@ -36,10 +36,10 @@ private implementation details that can be changed or removed. */ #ifndef YY_YY_YACC_SQL_HPP_INCLUDED -# define YY_YY_YACC_SQL_HPP_INCLUDED +#define YY_YY_YACC_SQL_HPP_INCLUDED /* Debug traces. */ #ifndef YYDEBUG -# define YYDEBUG 0 +#define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; @@ -47,125 +47,124 @@ extern int yydebug; /* Token kinds. */ #ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - YYEMPTY = -2, - YYEOF = 0, /* "end of file" */ - YYerror = 256, /* error */ - YYUNDEF = 257, /* "invalid token" */ - SEMICOLON = 258, /* SEMICOLON */ - AS = 259, /* AS */ - ASC = 260, /* ASC */ - BY = 261, /* BY */ - CREATE = 262, /* CREATE */ - DROP = 263, /* DROP */ - EXISTS = 264, /* EXISTS */ - GROUP = 265, /* GROUP */ - ORDER = 266, /* ORDER */ - TABLE = 267, /* TABLE */ - TABLES = 268, /* TABLES */ - INDEX = 269, /* INDEX */ - CALC = 270, /* CALC */ - SELECT = 271, /* SELECT */ - DESC = 272, /* DESC */ - SHOW = 273, /* SHOW */ - SYNC = 274, /* SYNC */ - INSERT = 275, /* INSERT */ - DELETE = 276, /* DELETE */ - UPDATE = 277, /* UPDATE */ - LBRACE = 278, /* LBRACE */ - RBRACE = 279, /* RBRACE */ - COMMA = 280, /* COMMA */ - TRX_BEGIN = 281, /* TRX_BEGIN */ - TRX_COMMIT = 282, /* TRX_COMMIT */ - TRX_ROLLBACK = 283, /* TRX_ROLLBACK */ - INT_T = 284, /* INT_T */ - IN = 285, /* IN */ - STRING_T = 286, /* STRING_T */ - FLOAT_T = 287, /* FLOAT_T */ - DATE_T = 288, /* DATE_T */ - TEXT_T = 289, /* TEXT_T */ - NOT = 290, /* NOT */ - UNIQUE = 291, /* UNIQUE */ - NULL_T = 292, /* NULL_T */ - NULLABLE = 293, /* NULLABLE */ - HELP = 294, /* HELP */ - EXIT = 295, /* EXIT */ - DOT = 296, /* DOT */ - INTO = 297, /* INTO */ - VALUES = 298, /* VALUES */ - FROM = 299, /* FROM */ - WHERE = 300, /* WHERE */ - AND = 301, /* AND */ - OR = 302, /* OR */ - SET = 303, /* SET */ - ON = 304, /* ON */ - LOAD = 305, /* LOAD */ - DATA = 306, /* DATA */ - INFILE = 307, /* INFILE */ - EXPLAIN = 308, /* EXPLAIN */ - STORAGE = 309, /* STORAGE */ - FORMAT = 310, /* FORMAT */ - INNER = 311, /* INNER */ - JOIN = 312, /* JOIN */ - EQ = 313, /* EQ */ - LT = 314, /* LT */ - GT = 315, /* GT */ - LE = 316, /* LE */ - GE = 317, /* GE */ - NE = 318, /* NE */ - LIKE = 319, /* LIKE */ - IS = 320, /* IS */ - NUMBER = 321, /* NUMBER */ - FLOAT = 322, /* FLOAT */ - ID = 323, /* ID */ - SSS = 324, /* SSS */ - UMINUS = 325 /* UMINUS */ - }; - typedef enum yytokentype yytoken_kind_t; +#define YYTOKENTYPE +enum yytokentype +{ + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + SEMICOLON = 258, /* SEMICOLON */ + AS = 259, /* AS */ + ASC = 260, /* ASC */ + BY = 261, /* BY */ + CREATE = 262, /* CREATE */ + DROP = 263, /* DROP */ + EXISTS = 264, /* EXISTS */ + GROUP = 265, /* GROUP */ + ORDER = 266, /* ORDER */ + TABLE = 267, /* TABLE */ + TABLES = 268, /* TABLES */ + INDEX = 269, /* INDEX */ + CALC = 270, /* CALC */ + SELECT = 271, /* SELECT */ + DESC = 272, /* DESC */ + SHOW = 273, /* SHOW */ + SYNC = 274, /* SYNC */ + INSERT = 275, /* INSERT */ + DELETE = 276, /* DELETE */ + UPDATE = 277, /* UPDATE */ + LBRACE = 278, /* LBRACE */ + RBRACE = 279, /* RBRACE */ + COMMA = 280, /* COMMA */ + TRX_BEGIN = 281, /* TRX_BEGIN */ + TRX_COMMIT = 282, /* TRX_COMMIT */ + TRX_ROLLBACK = 283, /* TRX_ROLLBACK */ + INT_T = 284, /* INT_T */ + IN = 285, /* IN */ + STRING_T = 286, /* STRING_T */ + FLOAT_T = 287, /* FLOAT_T */ + DATE_T = 288, /* DATE_T */ + TEXT_T = 289, /* TEXT_T */ + NOT = 290, /* NOT */ + UNIQUE = 291, /* UNIQUE */ + NULL_T = 292, /* NULL_T */ + NULLABLE = 293, /* NULLABLE */ + HELP = 294, /* HELP */ + EXIT = 295, /* EXIT */ + DOT = 296, /* DOT */ + INTO = 297, /* INTO */ + VALUES = 298, /* VALUES */ + FROM = 299, /* FROM */ + WHERE = 300, /* WHERE */ + AND = 301, /* AND */ + OR = 302, /* OR */ + SET = 303, /* SET */ + ON = 304, /* ON */ + LOAD = 305, /* LOAD */ + DATA = 306, /* DATA */ + INFILE = 307, /* INFILE */ + EXPLAIN = 308, /* EXPLAIN */ + STORAGE = 309, /* STORAGE */ + FORMAT = 310, /* FORMAT */ + INNER = 311, /* INNER */ + JOIN = 312, /* JOIN */ + EQ = 313, /* EQ */ + LT = 314, /* LT */ + GT = 315, /* GT */ + LE = 316, /* LE */ + GE = 317, /* GE */ + NE = 318, /* NE */ + LIKE = 319, /* LIKE */ + IS = 320, /* IS */ + NUMBER = 321, /* NUMBER */ + FLOAT = 322, /* FLOAT */ + ID = 323, /* ID */ + SSS = 324, /* SSS */ + UMINUS = 325 /* UMINUS */ +}; +typedef enum yytokentype yytoken_kind_t; #endif /* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 132 "yacc_sql.y" - ParsedSqlNode * sql_node; - Value * value; - enum CompOp comp; - RelAttrSqlNode * rel_attr; - std::vector * attr_infos; - AttrInfoSqlNode * attr_info; - Expression * expression; - std::vector> * expression_list; - std::vector * value_list; - std::vector> * values_list; - SetClauseSqlNode * set_clause; - std::vector * set_clauses; - JoinSqlNode * join_clauses; - std::vector * rel_attr_list; - std::vector * relation_list; - OrderBySqlNode * orderby_unit; - std::vector * orderby_list; - char * string; - int number; - float floats; - bool nullable_info; - std::vector * index_attr_list; - bool unique; + ParsedSqlNode *sql_node; + Value *value; + enum CompOp comp; + RelAttrSqlNode *rel_attr; + std::vector *attr_infos; + AttrInfoSqlNode *attr_info; + Expression *expression; + std::vector> *expression_list; + std::vector *value_list; + std::vector> *values_list; + SetClauseSqlNode *set_clause; + std::vector *set_clauses; + JoinSqlNode *join_clauses; + std::vector *rel_attr_list; + std::vector *relation_list; + OrderBySqlNode *orderby_unit; + std::vector *orderby_list; + char *string; + int number; + float floats; + bool nullable_info; + std::vector *index_attr_list; + bool unique; #line 160 "yacc_sql.hpp" - }; typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 +#define YYSTYPE_IS_TRIVIAL 1 +#define YYSTYPE_IS_DECLARED 1 #endif /* Location type. */ -#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +#if !defined YYLTYPE && !defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE YYLTYPE; struct YYLTYPE { @@ -174,14 +173,10 @@ struct YYLTYPE int last_line; int last_column; }; -# define YYLTYPE_IS_DECLARED 1 -# define YYLTYPE_IS_TRIVIAL 1 +#define YYLTYPE_IS_DECLARED 1 +#define YYLTYPE_IS_TRIVIAL 1 #endif - - - -int yyparse (const char * sql_string, ParsedSqlResult * sql_result, void * scanner); - +int yyparse(const char *sql_string, ParsedSqlResult *sql_result, void *scanner); #endif /* !YY_YY_YACC_SQL_HPP_INCLUDED */ diff --git a/src/observer/storage/record/record_manager.cpp b/src/observer/storage/record/record_manager.cpp index 1cfa4ee8..2fb68f6a 100644 --- a/src/observer/storage/record/record_manager.cpp +++ b/src/observer/storage/record/record_manager.cpp @@ -703,7 +703,7 @@ RC RecordFileHandler::get_record(const RID &rid, Record &record) return rc; } -RC RecordFileHandler::visit_record(const RID &rid, function updater) +RC RecordFileHandler::visit_record(const RID &rid, const function &updater) { unique_ptr page_handler(RecordPageHandler::create(storage_format_)); diff --git a/src/observer/storage/record/record_manager.h b/src/observer/storage/record/record_manager.h index 35e78a23..8228464a 100644 --- a/src/observer/storage/record/record_manager.h +++ b/src/observer/storage/record/record_manager.h @@ -412,7 +412,7 @@ class RecordFileHandler RC get_record(const RID &rid, Record &record); - RC visit_record(const RID &rid, function updater); + RC visit_record(const RID &rid, const function &updater); private: /** diff --git a/src/observer/storage/table/table.cpp b/src/observer/storage/table/table.cpp index 08630853..af4df841 100644 --- a/src/observer/storage/table/table.cpp +++ b/src/observer/storage/table/table.cpp @@ -15,6 +15,8 @@ See the Mulan PSL v2 for more details. */ #include #include +#include + #include "common/defs.h" #include "common/lang/string.h" #include "common/lang/span.h" @@ -237,7 +239,7 @@ RC Table::insert_record(Record &record) return rc; } -RC Table::visit_record(const RID &rid, function visitor) +RC Table::visit_record(const RID &rid, const function &visitor) { return record_handler_->visit_record(rid, visitor); } diff --git a/src/observer/storage/table/table.h b/src/observer/storage/table/table.h index af285967..2ca5a523 100644 --- a/src/observer/storage/table/table.h +++ b/src/observer/storage/table/table.h @@ -104,7 +104,7 @@ class Table * @param visitor * @return RC */ - RC visit_record(const RID &rid, function visitor); + RC visit_record(const RID &rid, const function &visitor); public: int32_t table_id() const { return table_meta_.table_id(); } diff --git a/src/observer/storage/trx/mvcc_trx.cpp b/src/observer/storage/trx/mvcc_trx.cpp index 7db72847..9c69b7d0 100644 --- a/src/observer/storage/trx/mvcc_trx.cpp +++ b/src/observer/storage/trx/mvcc_trx.cpp @@ -13,6 +13,8 @@ See the Mulan PSL v2 for more details. */ // #include "storage/trx/mvcc_trx.h" + +#include #include "storage/db/db.h" #include "storage/field/field.h" #include "storage/trx/mvcc_trx_log.h" @@ -154,7 +156,7 @@ RC MvccTrx::insert_record(Table *table, Record &record) ASSERT(rc == RC::SUCCESS, "failed to append insert record log. trx id=%d, table id=%d, rid=%s, record len=%d, rc=%s", trx_id_, table->table_id(), record.rid().to_string().c_str(), record.len(), strrc(rc)); - operations_.push_back(Operation(Operation::Type::INSERT, table, record.rid())); + operations_.emplace_back(Operation::Type::INSERT, table, record.rid()); return rc; } @@ -191,12 +193,36 @@ RC MvccTrx::delete_record(Table *table, Record &record) ASSERT(rc == RC::SUCCESS, "failed to append delete record log. trx id=%d, table id=%d, rid=%s, record len=%d, rc=%s", trx_id_, table->table_id(), record.rid().to_string().c_str(), record.len(), strrc(rc)); - operations_.push_back(Operation(Operation::Type::DELETE, table, record.rid())); + operations_.emplace_back(Operation::Type::DELETE, table, record.rid()); return RC::SUCCESS; } -RC MvccTrx::update_record(Table *table, Record &old_record, Record &new_record) { return RC::SUCCESS; } +RC MvccTrx::update_record(Table *table, Record &old_record, Record &new_record) +{ + Field begin_field; + Field end_field; + trx_fields(table, begin_field, end_field); + + // 更新的处理和插入一样,begin 设置负值,但是 end 保持不变,因为可能遇到一个老事务对旧数据的修改 + begin_field.set_int(new_record, -trx_id_); + end_field.set_int(new_record, trx_kit_.max_trx_id()); + + RC rc = table->update_record(old_record, new_record); + if (rc != RC::SUCCESS) { + LOG_WARN("failed to insert record into table. rc=%s", strrc(rc)); + return rc; + } + + // 不实现故障恢复应该不用日志 + // rc = log_handler_.insert_record(trx_id_, table, record.rid()); + // ASSERT(rc == RC::SUCCESS, "failed to append insert record log. trx id=%d, table id=%d, rid=%s, record len=%d, + // rc=%s", + // trx_id_, table->table_id(), record.rid().to_string().c_str(), record.len(), strrc(rc)); + + operations_.emplace_back(Operation::Type::UPDATE, table, old_record.rid(), old_record, new_record); + return rc; +} RC MvccTrx::visit_record(Table *table, Record &record, ReadWriteMode mode) { @@ -292,15 +318,28 @@ RC MvccTrx::commit() RC MvccTrx::commit_with_trx_id(int32_t commit_xid) { // TODO 原子性提交BUG:这里存在一个很大的问题,不能让其他事务一次性看到当前事务更新到的数据或同时看不到 + + // 当前事务在提交时,会逐个修改之前修改过的行数据,调整版本号。 + // 这造成的问题是,在某个时刻,有些行数据的版本号已经修改了,有些还没有。那可能会存在一个事务,能够看到已经修改完成版本号的行,但是看不到未修改的行。 + // 比如事务A,插入了3条数据,在提交的时候,逐个修改版本号,某个情况下可能会存在下面的场景(假设A的事务ID是90,commit + // id是100): + // + // record begin xid end xid data + // R1 100 +∞ ... + // R2 100 +∞ ... + // R3 -90 +∞ ... + // 此时有一个新的事务,假设事务号是 110,那么它可以看到记录R1和R2,但是看不到R3,因为R3从记录状态来看,还没有提交。 + RC rc = RC::SUCCESS; started_ = false; for (const Operation &operation : operations_) { switch (operation.type()) { case Operation::Type::INSERT: { - RID rid(operation.page_num(), operation.slot_num()); + RID rid = operation.rid(); Table *table = operation.table(); - Field begin_xid_field, end_xid_field; + + Field begin_xid_field, end_xid_field; trx_fields(table, begin_xid_field, end_xid_field); auto record_updater = [this, &begin_xid_field, commit_xid](Record &record) -> bool { @@ -320,8 +359,8 @@ RC MvccTrx::commit_with_trx_id(int32_t commit_xid) } break; case Operation::Type::DELETE: { + RID rid = operation.rid(); Table *table = operation.table(); - RID rid(operation.page_num(), operation.slot_num()); Field begin_xid_field, end_xid_field; trx_fields(table, begin_xid_field, end_xid_field); @@ -341,6 +380,29 @@ RC MvccTrx::commit_with_trx_id(int32_t commit_xid) rid.to_string().c_str(), strrc(rc)); } break; + case Operation::Type::UPDATE: { + RID rid = operation.rid(); + Table *table = operation.table(); + + Field begin_xid_field, end_xid_field; + trx_fields(table, begin_xid_field, end_xid_field); + + auto record_updater = [this, &begin_xid_field, commit_xid](Record &record) -> bool { + LOG_DEBUG("before commit update record. trx id=%d, begin xid=%d, commit xid=%d, lbt=%s", + trx_id_, begin_xid_field.get_int(record), commit_xid, lbt()); + ASSERT(begin_xid_field.get_int(record) == -trx_id_, + "got an invalid record while committing. end xid=%d, this trx id=%d", + begin_xid_field.get_int(record), trx_id_); + + begin_xid_field.set_int(record, commit_xid); + return true; + }; + + rc = operation.table()->visit_record(rid, record_updater); + ASSERT(rc == RC::SUCCESS, "failed to get record while committing. rid=%s, rc=%s", + rid.to_string().c_str(), strrc(rc)); + } break; + default: { ASSERT(false, "unsupported operation. type=%d", static_cast(operation.type())); } @@ -362,11 +424,10 @@ RC MvccTrx::rollback() RC rc = RC::SUCCESS; started_ = false; - for (auto iter = operations_.rbegin(), itend = operations_.rend(); iter != itend; ++iter) { - const Operation &operation = *iter; + for (auto &operation : std::ranges::reverse_view(operations_)) { switch (operation.type()) { case Operation::Type::INSERT: { - RID rid(operation.page_num(), operation.slot_num()); + RID rid = operation.rid(); Table *table = operation.table(); // 这里也可以不删除,仅仅给数据加个标识位,等垃圾回收器来收割也行 @@ -394,8 +455,8 @@ RC MvccTrx::rollback() } break; case Operation::Type::DELETE: { + RID rid = operation.rid(); Table *table = operation.table(); - RID rid(operation.page_num(), operation.slot_num()); ASSERT(rc == RC::SUCCESS, "failed to get record while rollback. rid=%s, rc=%s", rid.to_string().c_str(), strrc(rc)); @@ -420,6 +481,35 @@ RC MvccTrx::rollback() rid.to_string().c_str(), strrc(rc)); } break; + case Operation::Type::UPDATE: { + RID rid = operation.rid(); + Table *table = operation.table(); + + if (recovering_) { + // 恢复的时候,需要额外判断下当前记录是否还是当前事务拥有。是的话才能删除记录 + Record record; + rc = table->get_record(rid, record); + if (OB_SUCC(rc)) { + Field begin_xid_field, end_xid_field; + trx_fields(table, begin_xid_field, end_xid_field); + if (begin_xid_field.get_int(record) != -trx_id_) { + continue; + } + } else if (RC::RECORD_NOT_EXIST == rc) { + continue; + } else { + LOG_WARN("failed to get record while rollback. table=%s, rid=%s, rc=%s", + table->name(), rid.to_string().c_str(), strrc(rc)); + return rc; + } + } + + // 直接用旧的记录的时间戳覆盖 + rc = table->update_record(operation.updated_record(), operation.old_record()); + ASSERT(rc == RC::SUCCESS, "failed to update record while rollback. rid=%s, rc=%s", + rid.to_string().c_str(), strrc(rc)); + } break; + default: { ASSERT(false, "unsupported operation. type=%d", static_cast(operation.type())); } diff --git a/src/observer/storage/trx/mvcc_trx.h b/src/observer/storage/trx/mvcc_trx.h index 77482fac..f2f7aae9 100644 --- a/src/observer/storage/trx/mvcc_trx.h +++ b/src/observer/storage/trx/mvcc_trx.h @@ -74,7 +74,7 @@ class MvccTrx : public Trx */ MvccTrx(MvccTrxKit &trx_kit, LogHandler &log_handler); MvccTrx(MvccTrxKit &trx_kit, LogHandler &log_handler, int32_t trx_id); // used for recover - virtual ~MvccTrx(); + ~MvccTrx() override; RC insert_record(Table *table, Record &record) override; RC delete_record(Table *table, Record &record) override; diff --git a/src/observer/storage/trx/trx.h b/src/observer/storage/trx/trx.h index a1ad65da..750841ce 100644 --- a/src/observer/storage/trx/trx.h +++ b/src/observer/storage/trx/trx.h @@ -57,23 +57,29 @@ class Operation }; public: - Operation(Type type, Table *table, const RID &rid) - : type_(type), table_(table), page_num_(rid.page_num), slot_num_(rid.slot_num) + Operation(Type type, Table *table, const RID &rid) : type_(type), table_(table), rid_(rid) {} + Operation(Type type, Table *table, const RID &rid, Record &old_record, Record &updated_record) + : type_(type), table_(table), rid_(rid), old_record_(old_record), updated_record_(updated_record) {} - Type type() const { return type_; } - int32_t table_id() const { return table_->table_id(); } - Table *table() const { return table_; } - PageNum page_num() const { return page_num_; } - SlotNum slot_num() const { return slot_num_; } + Type type() const { return type_; } + int32_t table_id() const { return table_->table_id(); } + Table *table() const { return table_; } + RID rid() const { return rid_; } + PageNum page_num() const { return rid_.page_num; } + SlotNum slot_num() const { return rid_.slot_num; } + const Record &old_record() const { return old_record_; } + const Record &updated_record() const { return updated_record_; } private: ///< 操作的哪张表。这里直接使用表其实并不准确,因为表中的索引也可能有日志 Type type_; - Table *table_ = nullptr; - PageNum page_num_; // TODO use RID instead of page num and slot num - SlotNum slot_num_; + Table *table_ = nullptr; + RID rid_; + // update + Record old_record_{}; + Record updated_record_{}; }; class OperationHasher