MySQL 8.0.39
Source Code Documentation
sql_lexer.cc File Reference
#include "sql_lexer.h"
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <mutex>
#include <iostream>
#include "lex_string.h"
#include "m_ctype.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysql_version.h"
#include "sql/lexer_yystype.h"
#include "sql/sql_digest_stream.h"
#include "sql/sql_lex_hash.h"
#include "sql/sql_yacc.h"
#include "sql/system_variables.h"
#include "sql_chars.h"
#include "sql_lexer_input_stream.h"
#include "sql_lexer_thd.h"

Functions

sql_digest_statedigest_add_token (sql_digest_state *, uint, Lexer_yystype *)
 
sql_digest_statedigest_reduce_token (sql_digest_state *, uint, uint)
 
static int find_keyword (Lex_input_stream *lip, uint len, bool function)
 
static LEX_STRING get_token (Lex_input_stream *lip, uint skip, uint length)
 
static LEX_STRING get_quoted_token (Lex_input_stream *lip, uint skip, uint length, char quote)
 
static char * get_text (Lex_input_stream *lip, int pre_skip, int post_skip)
 
static uint int_token (const char *str, uint length)
 
static bool consume_comment (Lex_input_stream *lip, int remaining_recursions_permitted)
 Given a stream that is advanced to the first contained character in an open comment, consume the comment. More...
 
static int lex_one_token (Lexer_yystype *yylval, THD *thd)
 
bool lex_init (void)
 
static bool is_final_token (const SqlLexer::iterator::Token &tkn)
 
static bool is_keyword_or_func (const char *name, size_t len)
 
bool operator== (const SqlLexer::iterator &a, const SqlLexer::iterator &b)
 
bool operator!= (const SqlLexer::iterator &a, const SqlLexer::iterator &b)
 

Variables

static const char * long_str = "2147483647"
 
static const uint long_len = 10
 
static const char * signed_long_str = "-2147483648"
 
static const char * longlong_str = "9223372036854775807"
 
static const uint longlong_len = 19
 
static const char * signed_longlong_str = "-9223372036854775808"
 
static const uint signed_longlong_len = 19
 
static const char * unsigned_longlong_str = "18446744073709551615"
 
static const uint unsigned_longlong_len = 20
 
std::once_flag lexer_init
 

Function Documentation

◆ consume_comment()

static bool consume_comment ( Lex_input_stream lip,
int  remaining_recursions_permitted 
)
static

Given a stream that is advanced to the first contained character in an open comment, consume the comment.

Optionally, if we are allowed, recurse so that we understand comments within this current comment.

At this level, we do not support version-condition comments. We might have been called with having just passed one in the stream, though. In that case, we probably want to tolerate mundane comments inside. Thus, the case for recursion.

Return values
WhetherEOF reached before comment is closed.

◆ digest_add_token()

sql_digest_state * digest_add_token ( sql_digest_state state,
uint  token,
Lexer_yystype yylval 
)

◆ digest_reduce_token()

sql_digest_state * digest_reduce_token ( sql_digest_state state,
uint  token_left,
uint  token_right 
)

◆ find_keyword()

static int find_keyword ( Lex_input_stream lip,
uint  len,
bool  function 
)
static

◆ get_quoted_token()

static LEX_STRING get_quoted_token ( Lex_input_stream lip,
uint  skip,
uint  length,
char  quote 
)
static

◆ get_text()

static char * get_text ( Lex_input_stream lip,
int  pre_skip,
int  post_skip 
)
static

◆ get_token()

static LEX_STRING get_token ( Lex_input_stream lip,
uint  skip,
uint  length 
)
static

◆ int_token()

static uint int_token ( const char *  str,
uint  length 
)
inlinestatic

◆ is_final_token()

static bool is_final_token ( const SqlLexer::iterator::Token tkn)
static

◆ is_keyword_or_func()

static bool is_keyword_or_func ( const char *  name,
size_t  len 
)
static

◆ lex_one_token()

static int lex_one_token ( Lexer_yystype yylval,
THD thd 
)
static

◆ operator!=()

bool operator!= ( const SqlLexer::iterator a,
const SqlLexer::iterator b 
)

◆ operator==()

bool operator== ( const SqlLexer::iterator a,
const SqlLexer::iterator b 
)

Variable Documentation

◆ lexer_init

std::once_flag lexer_init

◆ long_len

const uint long_len = 10
static

◆ long_str

const char* long_str = "2147483647"
static

◆ longlong_len

const uint longlong_len = 19
static

◆ longlong_str

const char* longlong_str = "9223372036854775807"
static

◆ signed_long_str

const char* signed_long_str = "-2147483648"
static

◆ signed_longlong_len

const uint signed_longlong_len = 19
static

◆ signed_longlong_str

const char* signed_longlong_str = "-9223372036854775808"
static

◆ unsigned_longlong_len

const uint unsigned_longlong_len = 20
static

◆ unsigned_longlong_str

const char* unsigned_longlong_str = "18446744073709551615"
static