Commit c21fc008 authored by Alexander Barkov's avatar Alexander Barkov

Moving the code from my_parse_error() to THD::parse_error().

Reusing THD::parse_error() in sql_yacc.yy and sql_yacc_ora.yy
parent 9f6aca19
......@@ -3882,6 +3882,37 @@ class THD :public Statement,
*/
void raise_note_printf(uint code, ...);
/**
@brief Push an error message into MySQL error stack with line
and position information.
This function provides semantic action implementers with a way
to push the famous "You have a syntax error near..." error
message into the error stack, which is normally produced only if
a parse error is discovered internally by the Bison generated
parser.
*/
void parse_error(const char *err_text, const char *yytext)
{
Lex_input_stream *lip= &m_parser_state->m_lip;
if (!yytext)
{
if (!(yytext= lip->get_tok_start()))
yytext= "";
}
/* Push an error into the error stack */
ErrConvString err(yytext, strlen(yytext), variables.character_set_client);
my_printf_error(ER_PARSE_ERROR, ER_THD(this, ER_PARSE_ERROR), MYF(0),
err_text, err.ptr(), lip->yylineno);
}
void parse_error(uint err_number, const char *yytext= 0)
{
return parse_error(ER_THD(this, err_number), yytext);
}
void parse_error()
{
return parse_error(ER_SYNTAX_ERROR);
}
private:
/*
Only the implementation of the SIGNAL and RESIGNAL statements
......
......@@ -31,6 +31,13 @@
#include "sql_select.h"
#include "sql_cte.h"
void LEX::parse_error()
{
thd->parse_error();
}
static int lex_one_token(YYSTYPE *yylval, THD *thd);
/*
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment