Commit 760127ac authored by Alexander Barkov's avatar Alexander Barkov

Adding sf_return_type, improving sf_tail readability.

1. The "sf_tail" rule had a lot of rules with part markers, e.g:

     /* $1 */

They make the grammar really hard to read.
Removing all these markers.

2. Moving the RETURNS clause into a separate sp_return_type rule,
to make sf_tail even more simpler. Note, sp_return_type will be needed
soon for packages anyway.
parent 306bc90a
...@@ -16640,36 +16640,41 @@ udf_tail: ...@@ -16640,36 +16640,41 @@ udf_tail:
} }
; ;
sf_tail:
opt_if_not_exists /* $1 */ sf_return_type:
sp_name /* $2 */ RETURNS_SYM
{ /* $3 */ {
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
TYPE_ENUM_FUNCTION))
MYSQL_YYABORT;
Lex->spname= $2;
}
sp_parenthesized_fdparam_list /* $4 */
RETURNS_SYM /* $5 */
{ /* $6 */
LEX *lex= Lex; LEX *lex= Lex;
lex->init_last_field(&lex->sphead->m_return_field_def, lex->init_last_field(&lex->sphead->m_return_field_def,
&empty_clex_str, &empty_clex_str,
thd->variables.collation_database); thd->variables.collation_database);
} }
type_with_opt_collate /* $7 */ type_with_opt_collate
{ /* $8 */ {
if (Lex->sphead->fill_field_definition(thd, Lex->last_field)) if (Lex->sphead->fill_field_definition(thd, Lex->last_field))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
sp_c_chistics /* $9 */ ;
{ /* $10 */
sf_tail:
opt_if_not_exists
sp_name
{
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
TYPE_ENUM_FUNCTION))
MYSQL_YYABORT;
Lex->spname= $2;
}
sp_parenthesized_fdparam_list
sf_return_type
sp_c_chistics
{
LEX *lex= thd->lex; LEX *lex= thd->lex;
Lex_input_stream *lip= YYLIP; Lex_input_stream *lip= YYLIP;
lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); lex->sphead->set_body_start(thd, lip->get_cpp_tok_start());
} }
sp_proc_stmt_in_returns_clause /* $11 */ sp_proc_stmt_in_returns_clause
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
......
...@@ -16878,37 +16878,42 @@ udf_tail: ...@@ -16878,37 +16878,42 @@ udf_tail:
} }
; ;
sf_tail:
opt_if_not_exists /* $1 */ sf_return_type:
sp_name /* $2 */ RETURN_SYM
{ /* $3 */ {
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
TYPE_ENUM_FUNCTION))
MYSQL_YYABORT;
Lex->spname= $2;
}
opt_sp_parenthesized_fdparam_list /* $4 */
RETURN_SYM /* $5 */
{ /* $6 */
LEX *lex= Lex; LEX *lex= Lex;
lex->init_last_field(&lex->sphead->m_return_field_def, lex->init_last_field(&lex->sphead->m_return_field_def,
&empty_clex_str, &empty_clex_str,
thd->variables.collation_database); thd->variables.collation_database);
} }
sp_param_type_with_opt_collate /* $7 */ sp_param_type_with_opt_collate
{ /* $8 */ {
if (Lex->sphead->fill_field_definition(thd, Lex->last_field)) if (Lex->sphead->fill_field_definition(thd, Lex->last_field))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
sp_c_chistics /* $9 */ ;
{ /* $10 */
sf_tail:
opt_if_not_exists
sp_name
{
if (!Lex->make_sp_head_no_recursive(thd, $1, $2,
TYPE_ENUM_FUNCTION))
MYSQL_YYABORT;
Lex->spname= $2;
}
opt_sp_parenthesized_fdparam_list
sf_return_type
sp_c_chistics
{
LEX *lex= thd->lex; LEX *lex= thd->lex;
Lex_input_stream *lip= YYLIP; Lex_input_stream *lip= YYLIP;
lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); lex->sphead->set_body_start(thd, lip->get_cpp_tok_start());
} }
sp_tail_is /* $11 */ sp_tail_is
sp_body /* $12 */ sp_body
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
......
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