Skip to content

Commit

Permalink
feat: 初步实现 update-mvcc
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosthi committed Oct 9, 2024
1 parent a9924a6 commit f8a68ab
Show file tree
Hide file tree
Showing 11 changed files with 7,267 additions and 3,495 deletions.
5,453 changes: 3,700 additions & 1,753 deletions src/observer/sql/parser/lex_sql.cpp

Large diffs are not rendered by default.

244 changes: 119 additions & 125 deletions src/observer/sql/parser/lex_sql.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -81,62 +79,62 @@ while (0);

/* C99 systems have <inttypes.h>. 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 <inttypes.h>
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 */
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -544,7 +539,6 @@ extern int yylex \

#line 159 "lex_sql.l"


#line 548 "lex_sql.h"
#undef yyIN_HEADER
#endif /* yyHEADER_H */
Loading

0 comments on commit f8a68ab

Please sign in to comment.