diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-06-14 13:18:05 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-06-14 13:59:55 +0200 |
commit | c73b987e73343d49c0b98666552d7aeb1a9799da (patch) | |
tree | 0751f7cfdc8cf87c8783e6e3b5ec58ef2505d8bd /sql/sql_lex.cc | |
parent | c3c272cca45205b8ffc5c44b2cce136576649967 (diff) | |
download | mariadb-git-c73b987e73343d49c0b98666552d7aeb1a9799da.tar.gz |
MDEV-8328 Evaluation of two "!" operators depends on space in beetween
fix the lexer to backtrack when parsing
"<=", "<>", "!=", ">=", "<<", ">>", "<=>".
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7b8b37f61fd..ee0e09acbf9 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1452,32 +1452,35 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd) return (BIN_NUM); case MY_LEX_CMP_OP: // Incomplete comparison operator + lip->next_state= MY_LEX_START; // Allow signed numbers if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP || state_map[(uchar) lip->yyPeek()] == MY_LEX_LONG_CMP_OP) - lip->yySkip(); - if ((tokval = find_keyword(lip, lip->yyLength() + 1, 0))) { - lip->next_state= MY_LEX_START; // Allow signed numbers - return(tokval); + lip->yySkip(); + if ((tokval= find_keyword(lip, 2, 0))) + return(tokval); + lip->yyUnget(); } - state = MY_LEX_CHAR; // Something fishy found - break; + return(c); case MY_LEX_LONG_CMP_OP: // Incomplete comparison operator + lip->next_state= MY_LEX_START; if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP || state_map[(uchar) lip->yyPeek()] == MY_LEX_LONG_CMP_OP) { lip->yySkip(); if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP) + { lip->yySkip(); + if ((tokval= find_keyword(lip, 3, 0))) + return(tokval); + lip->yyUnget(); + } + if ((tokval= find_keyword(lip, 2, 0))) + return(tokval); + lip->yyUnget(); } - if ((tokval = find_keyword(lip, lip->yyLength() + 1, 0))) - { - lip->next_state= MY_LEX_START; // Found long op - return(tokval); - } - state = MY_LEX_CHAR; // Something fishy found - break; + return(c); case MY_LEX_BOOL: if (c != lip->yyPeek()) |