mirror of
https://github.com/MariaDB/server.git
synced 2025-07-24 19:42:23 +03:00
Moving a few static functions in sql_lex.cc to new methods in Lex_input_stream
Reasoning: - Shorter and clearer code - Better encapsulation (a fair number of Lex_input_stream methods and members were moved to the private section) New methods: int lex_token(union YYSTYPE *yylval, THD *thd); bool consume_comment(int remaining_recursions_permitted); int lex_one_token(union YYSTYPE *yylval, THD *thd); int find_keyword(Lex_ident_cli_st *str, uint len, bool function); LEX_CSTRING get_token(uint skip, uint length); Additional changes: - Removing Lex_input_stream::yylval. In the original code it was just an alias for the "yylval" passed to lex_one_token(). This coding style is bug prone and is hard to follow. In the new reduction "yylval" (or its components) is passed to the affected methods as a parameter. - Moving the code in sql_lex.h up and down between "private" and "public" sections (sorry if this made the diff somewhat harder to read)
This commit is contained in:
@ -4250,7 +4250,7 @@ public:
|
||||
Lex_input_stream *lip= &m_parser_state->m_lip;
|
||||
if (!yytext)
|
||||
{
|
||||
if (lip->lookahead_token >= 0)
|
||||
if (lip->has_lookahead())
|
||||
yytext= lip->get_tok_start_prev();
|
||||
else
|
||||
yytext= lip->get_tok_start();
|
||||
|
Reference in New Issue
Block a user