Commit 2e0c23d8 authored by Alexander Barkov's avatar Alexander Barkov

Removing redundant "%left INTERVAL_SYM" and "%prec INTERVAL_SYM"

These directives did not have any affect.

All these affected lines:

1.  | INTERVAL_SYM expr interval '+' expr

2.  | INTERVAL_SYM '(' expr ',' expr ')'

3.  | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')'

4.  | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'

5.  | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'

define the grammar unambiguously.

"bison -v sql_yacc.yy" produces exactly the same sql_yacc.output
before and after the change.
parent 06f539da
......@@ -1668,7 +1668,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left NEG '~'
%right NOT_SYM NOT2_SYM
%right BINARY COLLATE_SYM
%left INTERVAL_SYM
%type <lex_str>
DECIMAL_NUM FLOAT_NUM NUM LONG_NUM
......@@ -9780,7 +9779,7 @@ bit_expr:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
| INTERVAL_SYM expr interval '+' expr
/* we cannot put interval before - */
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $5, $2, $3, 0);
......@@ -10234,7 +10233,7 @@ function_call_keyword:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
| INTERVAL_SYM '(' expr ',' expr ')'
{
List<Item> *list= new (thd->mem_root) List<Item>;
if (unlikely(list == NULL))
......@@ -10249,7 +10248,7 @@ function_call_keyword:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')'
{
$7->push_front($5, thd->mem_root);
$7->push_front($3, thd->mem_root);
......@@ -10363,14 +10362,12 @@ function_call_nonkeyword:
Lex->safe_to_cache_query=0;
}
| DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
%prec INTERVAL_SYM
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 0);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
%prec INTERVAL_SYM
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 1);
if (unlikely($$ == NULL))
......
......@@ -1054,7 +1054,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left NEG '~'
%right NOT_SYM NOT2_SYM
%right BINARY COLLATE_SYM
%left INTERVAL_SYM
%type <lex_str>
DECIMAL_NUM FLOAT_NUM NUM LONG_NUM
......@@ -9526,7 +9525,7 @@ bit_expr:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
| INTERVAL_SYM expr interval '+' expr
/* we cannot put interval before - */
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $5, $2, $3, 0);
......@@ -10017,7 +10016,7 @@ function_call_keyword:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
| INTERVAL_SYM '(' expr ',' expr ')'
{
List<Item> *list= new (thd->mem_root) List<Item>;
if (unlikely(list == NULL))
......@@ -10031,7 +10030,7 @@ function_call_keyword:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
| INTERVAL_SYM '(' expr ',' expr ',' expr_list ')'
{
$7->push_front($5, thd->mem_root);
$7->push_front($3, thd->mem_root);
......@@ -10162,14 +10161,12 @@ function_call_nonkeyword:
Lex->safe_to_cache_query=0;
}
| DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
%prec INTERVAL_SYM
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 0);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
| DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
%prec INTERVAL_SYM
{
$$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 1);
if (unlikely($$ == NULL))
......
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