From 71485e7c7b82280b390cd9e0eae694c2ca6c09df Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 17 Aug 2014 20:46:46 +0200 Subject: [PATCH] cleanup sql_yacc: introduce opt_not rule, combine otherwise duplicate rules --- sql/sql_yacc.yy | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f54973eb8d3..2e52bff7e09 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1677,7 +1677,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); table_option opt_if_not_exists create_or_replace opt_no_write_to_binlog opt_temporary all_or_any opt_distinct opt_ignore_leaves fulltext_options spatial_type union_option - field_def + field_def opt_not union_opt select_derived_init transaction_access_mode_types opt_natural_language_mode opt_query_expansion opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment @@ -2627,16 +2627,11 @@ opt_ev_on_completion: ; ev_on_completion: - ON COMPLETION_SYM PRESERVE_SYM + ON COMPLETION_SYM opt_not PRESERVE_SYM { - Lex->event_parse_data->on_completion= - Event_parse_data::ON_COMPLETION_PRESERVE; - $$= 1; - } - | ON COMPLETION_SYM NOT_SYM PRESERVE_SYM - { - Lex->event_parse_data->on_completion= - Event_parse_data::ON_COMPLETION_DROP; + Lex->event_parse_data->on_completion= $3 + ? Event_parse_data::ON_COMPLETION_DROP + : Event_parse_data::ON_COMPLETION_PRESERVE; $$= 1; } ; @@ -2802,8 +2797,7 @@ sp_chistic: /* Create characteristics */ sp_c_chistic: sp_chistic { } - | DETERMINISTIC_SYM { Lex->sp_chistics.detistic= TRUE; } - | not DETERMINISTIC_SYM { Lex->sp_chistics.detistic= FALSE; } + | opt_not DETERMINISTIC_SYM { Lex->sp_chistics.detistic= ! $1; } ; sp_suid: @@ -15628,6 +15622,10 @@ begin: lex->start_transaction_opt= 0; } opt_work {} + +opt_not: + /* nothing */ { $$= 0; } + | not { $$= 1; } ; opt_work: