diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-11-19 12:41:01 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-11-19 12:41:01 +0400 |
commit | b5ac863f1494920b5e7035c9dfa0ebfdaa50a15d (patch) | |
tree | 9567613f5237e56169d480b7120491aad6c5381f /sql | |
parent | 7debbd78596875619bf64af3b1a2406482be36a2 (diff) | |
download | mariadb-git-b5ac863f1494920b5e7035c9dfa0ebfdaa50a15d.tar.gz |
Grammar cleanup: adding missing and removing redundant semicolons
modified: sql_yacc.yy
modified: sql_yacc_ora.yy
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_yacc.yy | 56 | ||||
-rw-r--r-- | sql/sql_yacc_ora.yy | 71 |
2 files changed, 81 insertions, 46 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 44c22eab665..3a2c9bb67d6 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2908,6 +2908,7 @@ sf_tail_not_aggregate: } Lex->sphead->set_chistics_agg_type(NOT_AGGREGATE); } + ; sf_tail_aggregate: sf_tail @@ -2918,6 +2919,7 @@ sf_tail_aggregate: } Lex->sphead->set_chistics_agg_type(GROUP_AGGREGATE); } + ; create_function_tail: sf_tail_not_aggregate { } @@ -3959,6 +3961,7 @@ statement_information_item: if (unlikely($$ == NULL)) MYSQL_YYABORT; } + ; simple_target_specification: ident_cli @@ -4013,6 +4016,7 @@ condition_information_item: if (unlikely($$ == NULL)) MYSQL_YYABORT; } + ; condition_information_item_name: CLASS_ORIGIN_SYM @@ -7014,10 +7018,12 @@ field_length: opt_field_length: /* empty */ { $$= (char*) 0; /* use default length */ } | field_length { $$= $1; } + ; opt_field_length_default_1: /* empty */ { $$= (char*) "1"; } | field_length { $$= $1; } + ; opt_precision: /* empty */ { $$.set(0, 0); } @@ -7478,12 +7484,14 @@ fulltext_key_opts: opt_USING_key_algorithm: /* Empty*/ { $$= HA_KEY_ALG_UNDEF; } | USING btree_or_rtree { $$= $2; } + ; /* TYPE is a valid identifier, so it's handled differently than USING */ opt_key_algorithm_clause: /* Empty*/ { $$= HA_KEY_ALG_UNDEF; } | USING btree_or_rtree { $$= $2; } | TYPE_SYM btree_or_rtree { $$= $2; } + ; key_using_alg: USING btree_or_rtree @@ -8302,6 +8310,7 @@ opt_index_lock_algorithm: | alter_algorithm_option | alter_lock_option alter_algorithm_option | alter_algorithm_option alter_lock_option + ; alter_algorithm_option: ALGORITHM_SYM opt_equal DEFAULT @@ -8360,7 +8369,7 @@ alter_option: Lex->alter_info.requested_lock= Alter_info::ALTER_TABLE_LOCK_NONE; } - + ; opt_restrict: /* empty */ { Lex->drop_mode= DROP_DEFAULT; } @@ -8627,6 +8636,7 @@ persistent_stat_spec: {} | COLUMNS persistent_column_stat_spec INDEXES persistent_index_stat_spec {} + ; persistent_column_stat_spec: ALL {} @@ -9159,7 +9169,6 @@ query_expression: } ; - subselect: remember_tok_start query_expression @@ -9416,13 +9425,13 @@ select_alias: opt_default_time_precision: /* empty */ { $$= NOT_FIXED_DEC; } | '(' ')' { $$= NOT_FIXED_DEC; } - | '(' real_ulong_num ')' { $$= $2; }; + | '(' real_ulong_num ')' { $$= $2; } ; opt_time_precision: /* empty */ { $$= 0; } | '(' ')' { $$= 0; } - | '(' real_ulong_num ')' { $$= $2; }; + | '(' real_ulong_num ')' { $$= $2; } ; optional_braces: @@ -9927,6 +9936,7 @@ dyncall_create_element: else $$->len= 0; } + ; dyncall_create_list: dyncall_create_element @@ -11389,7 +11399,7 @@ opt_gconcat_separator: opt_gorder_clause: /* empty */ - | ORDER_SYM BY gorder_list; + | ORDER_SYM BY gorder_list ; gorder_list: @@ -11787,7 +11797,7 @@ use_partition: $$= $3; } ; - + table_factor: table_primary_ident { $$= $1; } | table_primary_derived { $$= $1; } @@ -11885,7 +11895,6 @@ table_primary_derived: } ; - opt_outer: /* empty */ {} | OUTER {} @@ -12188,6 +12197,7 @@ opt_window_ref: if (unlikely(thd->lex->win_ref == NULL)) MYSQL_YYABORT; } + ; opt_window_partition_clause: /* empty */ { } @@ -12394,6 +12404,7 @@ opt_global_limit_clause: Select->select_limit= $1.select_limit; Select->offset_limit= $1.offset_limit; } + ; limit_options: limit_option @@ -12457,6 +12468,7 @@ limit_rows_option: LEX *lex=Lex; lex->limit_rows_examined= $1; } + ; delete_limit_clause: /* empty */ @@ -12554,6 +12566,7 @@ opt_plus: int_num: opt_plus NUM { int error; $$= (int) my_strtoll10($2.str, (char**) 0, &error); } | '-' NUM { int error; $$= -(int) my_strtoll10($2.str, (char**) 0, &error); } + ; ulong_num: opt_plus NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); } @@ -12577,7 +12590,7 @@ longlong_num: | LONG_NUM { int error; $$= (longlong) my_strtoll10($1.str, (char**) 0, &error); } | '-' NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); } | '-' LONG_NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); } - + ; ulonglong_num: opt_plus NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); } @@ -12614,6 +12627,7 @@ bool: ulong_num { $$= $1 != 0; } | TRUE_SYM { $$= 1; } | FALSE_SYM { $$= 0; } + ; procedure_clause: PROCEDURE_SYM ident /* Procedure name */ @@ -12994,7 +13008,7 @@ insert: { LEX *lex= Lex; lex->sql_command= SQLCOM_INSERT; - lex->duplicates= DUP_ERROR; + lex->duplicates= DUP_ERROR; if (Lex->main_select_push()) MYSQL_YYABORT; mysql_init_select(lex); @@ -14282,6 +14296,7 @@ delete_domain_id: optional_flush_tables_arguments: /* empty */ {$$= 0;} | AND_SYM DISABLE_SYM CHECKPOINT_SYM {$$= REFRESH_CHECKPOINT; } + ; reset: RESET_SYM @@ -14376,6 +14391,7 @@ kill_type: /* Empty */ { $$= (int) KILL_HARD_BIT; } | HARD_SYM { $$= (int) KILL_HARD_BIT; } | SOFT_SYM { $$= 0; } + ; kill_option: /* empty */ { $$= (int) KILL_CONNECTION; } @@ -16341,6 +16357,7 @@ handler: { Lex->pop_select(); //main select } + ; handler_tail: table_ident OPEN_SYM opt_table_alias_clause @@ -16534,12 +16551,14 @@ grant_command: ; opt_with_admin: - /* nothing */ { Lex->definer = 0; } - | WITH ADMIN_SYM user_or_role { Lex->definer = $3; } + /* nothing */ { Lex->definer = 0; } + | WITH ADMIN_SYM user_or_role { Lex->definer = $3; } + ; opt_with_admin_option: - /* nothing */ { Lex->with_admin_option= false; } - | WITH ADMIN_SYM OPTION { Lex->with_admin_option= true; } + /* nothing */ { Lex->with_admin_option= false; } + | WITH ADMIN_SYM OPTION { Lex->with_admin_option= true; } + ; role_list: grant_role @@ -17040,7 +17059,7 @@ unit_type_decl: { $$.unit_type= INTERSECT_TYPE; $$.distinct= 1; } | EXCEPT_SYM { $$.unit_type= EXCEPT_TYPE; $$.distinct= 1; } - + ; /* Start a UNION, for non-top level query expressions. @@ -17495,10 +17514,11 @@ uninstall: /* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */ keep_gcc_happy: - IMPOSSIBLE_ACTION - { - YYERROR; - } + IMPOSSIBLE_ACTION + { + YYERROR; + } + ; /** @} (end of group Parser) diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 67f0f08f824..6c28c571dce 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -3827,6 +3827,7 @@ statement_information_item: if (unlikely($$ == NULL)) MYSQL_YYABORT; } + ; simple_target_specification: ident_cli @@ -3881,6 +3882,7 @@ condition_information_item: if (unlikely($$ == NULL)) MYSQL_YYABORT; } + ; condition_information_item_name: CLASS_ORIGIN_SYM @@ -5236,7 +5238,6 @@ create_select_query_expression: SELECT_LEX *first_select= $3->first_select(); $3->set_with_clause($2); $2->attach_to(first_select); - if (Lex->parsed_insert_select(first_select)) MYSQL_YYABORT; } @@ -7128,11 +7129,12 @@ field_length: opt_field_length: /* empty */ { $$= (char*) 0; /* use default length */ } | field_length { $$= $1; } + ; opt_field_length_default_1: /* empty */ { $$= (char*) "1"; } | field_length { $$= $1; } - + ; /* In sql_mode=ORACLE, real size of VARCHAR and CHAR with no length @@ -7154,10 +7156,12 @@ opt_field_length_default_1: opt_field_length_default_sp_param_varchar: /* empty */ { $$.set("4000", "4000"); } | field_length { $$.set($1, NULL); } + ; opt_field_length_default_sp_param_char: /* empty */ { $$.set("2000", "2000"); } | field_length { $$.set($1, NULL); } + ; opt_precision: /* empty */ { $$.set(0, 0); } @@ -7631,12 +7635,14 @@ fulltext_key_opts: opt_USING_key_algorithm: /* Empty*/ { $$= HA_KEY_ALG_UNDEF; } | USING btree_or_rtree { $$= $2; } + ; /* TYPE is a valid identifier, so it's handled differently than USING */ opt_key_algorithm_clause: /* Empty*/ { $$= HA_KEY_ALG_UNDEF; } | USING btree_or_rtree { $$= $2; } | TYPE_SYM btree_or_rtree { $$= $2; } + ; key_using_alg: USING btree_or_rtree @@ -8389,7 +8395,6 @@ alter_list_item: if (lex->first_select_lex()->db.str == NULL && lex->copy_db_to(&lex->first_select_lex()->db)) MYSQL_YYABORT; - if (unlikely(check_table_name($3->table.str,$3->table.length, FALSE)) || ($3->db.str && unlikely(check_db_name((LEX_STRING*) &$3->db)))) @@ -8453,6 +8458,7 @@ opt_index_lock_algorithm: | alter_algorithm_option | alter_lock_option alter_algorithm_option | alter_algorithm_option alter_lock_option + ; alter_algorithm_option: ALGORITHM_SYM opt_equal DEFAULT @@ -8511,7 +8517,7 @@ alter_option: Lex->alter_info.requested_lock= Alter_info::ALTER_TABLE_LOCK_NONE; } - + ; opt_restrict: /* empty */ { Lex->drop_mode= DROP_DEFAULT; } @@ -8778,6 +8784,7 @@ persistent_stat_spec: {} | COLUMNS persistent_column_stat_spec INDEXES persistent_index_stat_spec {} + ; persistent_column_stat_spec: ALL {} @@ -9105,7 +9112,6 @@ opt_ignore_leaves: Select : retrieve data from table */ - select: query_expression_body { @@ -9159,7 +9165,7 @@ simple_table: query_specification { $$= $1; } | table_value_constructor { $$= $1; } ; - + table_value_constructor: VALUES { @@ -9172,7 +9178,7 @@ table_value_constructor: MYSQL_YYABORT; } ; - + query_specification_start: SELECT_SYM { @@ -9222,8 +9228,9 @@ select_into_query_specification: opt_from_clause: /* Empty */ | from_clause - ; - + ; + + query_primary: simple_table { $$= $1; } @@ -9456,7 +9463,6 @@ select_lock_type: } ; - opt_select_lock_type: /* empty */ { @@ -9468,7 +9474,6 @@ opt_select_lock_type: } ; - opt_lock_wait_timeout_new: /* empty */ { @@ -9580,13 +9585,13 @@ select_alias: opt_default_time_precision: /* empty */ { $$= NOT_FIXED_DEC; } | '(' ')' { $$= NOT_FIXED_DEC; } - | '(' real_ulong_num ')' { $$= $2; }; + | '(' real_ulong_num ')' { $$= $2; } ; opt_time_precision: /* empty */ { $$= 0; } | '(' ')' { $$= 0; } - | '(' real_ulong_num ')' { $$= $2; }; + | '(' real_ulong_num ')' { $$= $2; } ; optional_braces: @@ -10085,6 +10090,7 @@ dyncall_create_element: else $$->len= 0; } + ; dyncall_create_list: dyncall_create_element @@ -11594,7 +11600,7 @@ opt_gconcat_separator: opt_gorder_clause: /* empty */ - | ORDER_SYM BY gorder_list; + | ORDER_SYM BY gorder_list ; gorder_list: @@ -12418,6 +12424,7 @@ opt_window_ref: if (unlikely(thd->lex->win_ref == NULL)) MYSQL_YYABORT; } + ; opt_window_partition_clause: /* empty */ { } @@ -12624,6 +12631,7 @@ opt_global_limit_clause: Select->select_limit= $1.select_limit; Select->offset_limit= $1.offset_limit; } + ; limit_options: limit_option @@ -12687,6 +12695,7 @@ limit_rows_option: LEX *lex=Lex; lex->limit_rows_examined= $1; } + ; delete_limit_clause: /* empty */ @@ -12784,6 +12793,7 @@ opt_plus: int_num: opt_plus NUM { int error; $$= (int) my_strtoll10($2.str, (char**) 0, &error); } | '-' NUM { int error; $$= -(int) my_strtoll10($2.str, (char**) 0, &error); } + ; ulong_num: opt_plus NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); } @@ -12807,7 +12817,7 @@ longlong_num: | LONG_NUM { int error; $$= (longlong) my_strtoll10($1.str, (char**) 0, &error); } | '-' NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); } | '-' LONG_NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); } - + ; ulonglong_num: opt_plus NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); } @@ -12844,6 +12854,7 @@ bool: ulong_num { $$= $1 != 0; } | TRUE_SYM { $$= 1; } | FALSE_SYM { $$= 0; } + ; procedure_clause: PROCEDURE_SYM ident /* Procedure name */ @@ -13243,7 +13254,7 @@ insert: lex->duplicates= DUP_ERROR; if (Lex->main_select_push()) MYSQL_YYABORT; - mysql_init_select(lex); + mysql_init_select(lex); lex->current_select->parsing_place= BEFORE_OPT_LIST; } insert_lock_option @@ -13268,7 +13279,7 @@ replace: lex->duplicates= DUP_REPLACE; if (Lex->main_select_push()) MYSQL_YYABORT; - mysql_init_select(lex); + mysql_init_select(lex); lex->current_select->parsing_place= BEFORE_OPT_LIST; } replace_lock_option insert2 @@ -13624,7 +13635,6 @@ delete_part2: } ; - delete_single_table: FROM table_ident opt_use_partition { @@ -13681,7 +13691,6 @@ single_multi: } ; - opt_select_expressions: /* empty */ | RETURNING_SYM select_item_list @@ -14536,6 +14545,7 @@ delete_domain_id: optional_flush_tables_arguments: /* empty */ {$$= 0;} | AND_SYM DISABLE_SYM CHECKPOINT_SYM {$$= REFRESH_CHECKPOINT; } + ; reset: RESET_SYM @@ -14628,6 +14638,7 @@ kill_type: /* Empty */ { $$= (int) KILL_HARD_BIT; } | HARD_SYM { $$= (int) KILL_HARD_BIT; } | SOFT_SYM { $$= 0; } + ; kill_option: /* empty */ { $$= (int) KILL_CONNECTION; } @@ -16686,6 +16697,7 @@ handler: { Lex->pop_select(); //main select } + ; handler_tail: table_ident OPEN_SYM opt_table_alias_clause @@ -16905,12 +16917,14 @@ grant_command: ; opt_with_admin: - /* nothing */ { Lex->definer = 0; } - | WITH ADMIN_SYM user_or_role { Lex->definer = $3; } + /* nothing */ { Lex->definer = 0; } + | WITH ADMIN_SYM user_or_role { Lex->definer = $3; } + ; opt_with_admin_option: - /* nothing */ { Lex->with_admin_option= false; } - | WITH ADMIN_SYM OPTION { Lex->with_admin_option= true; } + /* nothing */ { Lex->with_admin_option= false; } + | WITH ADMIN_SYM OPTION { Lex->with_admin_option= true; } + ; role_list: grant_role @@ -17401,11 +17415,11 @@ unit_type_decl: { $$.unit_type= INTERSECT_TYPE; $$.distinct= 1; } | EXCEPT_SYM { $$.unit_type= EXCEPT_TYPE; $$.distinct= 1; } + ; /* Start a UNION, for non-top level query expressions. */ - union_option: /* empty */ { $$=1; } | DISTINCT { $$=1; } @@ -17887,10 +17901,11 @@ uninstall: /* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */ keep_gcc_happy: - IMPOSSIBLE_ACTION - { - YYERROR; - } + IMPOSSIBLE_ACTION + { + YYERROR; + } + ; /** @} (end of group Parser) |