Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b1e0dcc0
Commit
b1e0dcc0
authored
Aug 22, 2007
by
malff/marcsql@weblab.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Manual merge
parent
74bbe205
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
43 deletions
+96
-43
sql/sql_yacc.yy
sql/sql_yacc.yy
+96
-43
No files found.
sql/sql_yacc.yy
View file @
b1e0dcc0
...
@@ -508,10 +508,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
...
@@ -508,10 +508,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%pure_parser /* We have threads */
%pure_parser /* We have threads */
/*
/*
Currently there
is 286 shift/reduce conflict. We should not introduce
Currently there
are 280 shift/reduce conflicts.
new conflicts any more.
We should not introduce
new conflicts any more.
*/
*/
%expect 28
6
%expect 28
0
/*
/*
Comments for TOKENS.
Comments for TOKENS.
...
@@ -1089,7 +1089,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
...
@@ -1089,7 +1089,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
/* A dummy token to force the priority of table_ref production in a join. */
/* A dummy token to force the priority of table_ref production in a join. */
%left TABLE_REF_PRIORITY
%left TABLE_REF_PRIORITY
%left SET_VAR
%left SET_VAR
%left OR_OR_SYM OR_SYM OR2_SYM XOR
%left OR_OR_SYM OR_SYM OR2_SYM
%left XOR
%left AND_SYM AND_AND_SYM
%left AND_SYM AND_AND_SYM
%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
%left EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE REGEXP IN_SYM
%left EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE REGEXP IN_SYM
...
@@ -1102,6 +1103,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
...
@@ -1102,6 +1103,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%left NEG '~'
%left NEG '~'
%right NOT_SYM NOT2_SYM
%right NOT_SYM NOT2_SYM
%right BINARY COLLATE_SYM
%right BINARY COLLATE_SYM
%left INTERVAL_SYM
%type <lex_str>
%type <lex_str>
IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
...
@@ -1150,7 +1152,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
...
@@ -1150,7 +1152,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <item>
%type <item>
literal text_literal insert_ident order_ident
literal text_literal insert_ident order_ident
simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr
simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr
variable variable_aux bool_
term bool_factor bool_test bool_pri
variable variable_aux bool_
factor bool_test bool_pri
predicate bit_expr bit_term bit_factor value_expr term factor
predicate bit_expr bit_term bit_factor value_expr term factor
table_wild simple_expr udf_expr
table_wild simple_expr udf_expr
expr_or_default set_expr_or_default interval_expr
expr_or_default set_expr_or_default interval_expr
...
@@ -6554,53 +6556,103 @@ optional_braces:
...
@@ -6554,53 +6556,103 @@ optional_braces:
;
;
/* all possible expressions */
/* all possible expressions */
expr:
expr:
bool_term { Select->expr_list.push_front(new List<Item>); }
bool_factor
bool_or_expr
| expr or expr %prec OR_SYM
{
{
List<Item> *list= Select->expr_list.pop();
/*
if (list->elements)
Design notes:
Do not use a manually maintained stack like thd->lex->xxx_list,
but use the internal bison stack ($$, $1 and $3) instead.
Using the bison stack is:
- more robust to changes in the grammar,
- guaranteed to be in sync with the parser state,
- better for performances (no memory allocation).
*/
Item_cond_or *item1;
Item_cond_or *item3;
if (is_cond_or($1))
{
{
list->push_front($1);
item1= (Item_cond_or*) $1;
$$= new Item_cond_or(*list);
if (is_cond_or($3))
/* optimize construction of logical OR to reduce
{
amount of objects for complex expressions */
item3= (Item_cond_or*) $3;
/*
(X1 OR X2) OR (Y1 OR Y2) ==> OR (X1, X2, Y1, Y2)
*/
item3->add_at_head(item1->argument_list());
$$ = $3;
}
else
{
/*
(X1 OR X2) OR Y ==> OR (X1, X2, Y)
*/
item1->add($3);
$$ = $1;
}
}
else if (is_cond_or($3))
{
item3= (Item_cond_or*) $3;
/*
X OR (Y1 OR Y2) ==> OR (X, Y1, Y2)
*/
item3->add_at_head($1);
$$ = $3;
}
}
else
else
$$= $1;
{
delete list;
/* X OR Y */
$$ = new (YYTHD->mem_root) Item_cond_or($1, $3);
}
}
}
;
| expr XOR expr %prec XOR
{
bool_or_expr:
/* XOR is a proprietary extension */
/* empty */
$$ = new (YYTHD->mem_root) Item_cond_xor($1, $3);
| bool_or_expr or bool_term
}
{ Select->expr_list.head()->push_back($3); }
| expr and expr %prec AND_SYM
;
bool_term:
bool_term XOR bool_term { $$= new Item_cond_xor($1,$3); }
| bool_factor { Select->expr_list.push_front(new List<Item>); }
bool_and_expr
{
{
List<Item> *list= Select->expr_list.pop();
/* See comments in rule expr: expr or expr */
if (list->elements)
Item_cond_and *item1;
Item_cond_and *item3;
if (is_cond_and($1))
{
{
list->push_front($1);
item1= (Item_cond_and*) $1;
$$= new Item_cond_and(*list);
if (is_cond_and($3))
/* optimize construction of logical AND to reduce
{
amount of objects for complex expressions */
item3= (Item_cond_and*) $3;
/*
(X1 AND X2) AND (Y1 AND Y2) ==> AND (X1, X2, Y1, Y2)
*/
item3->add_at_head(item1->argument_list());
$$ = $3;
}
else
{
/*
(X1 AND X2) AND Y ==> AND (X1, X2, Y)
*/
item1->add($3);
$$ = $1;
}
}
else if (is_cond_and($3))
{
item3= (Item_cond_and*) $3;
/*
X AND (Y1 AND Y2) ==> AND (X, Y1, Y2)
*/
item3->add_at_head($1);
$$ = $3;
}
}
else
else
$$= $1;
{
delete list;
/* X AND Y */
$$ = new (YYTHD->mem_root) Item_cond_and($1, $3);
}
}
}
;
bool_and_expr:
/* empty */
| bool_and_expr and bool_factor
{ Select->expr_list.head()->push_back($3); }
;
;
bool_factor:
bool_factor:
...
@@ -6766,7 +6818,8 @@ all_or_any:
...
@@ -6766,7 +6818,8 @@ all_or_any:
;
;
interval_expr:
interval_expr:
INTERVAL_SYM expr { $$=$2; }
INTERVAL_SYM expr %prec INTERVAL_SYM
{ $$=$2; }
;
;
simple_expr:
simple_expr:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment