recognize _binary literal

This commit is contained in:
jingxiaobing 2018-08-09 14:08:41 +08:00
parent 5278bbea80
commit 0be8f58e3e
4 changed files with 9 additions and 1 deletions

View File

@ -10,3 +10,4 @@
#define TK_PROPERTY_START (TK_CUSTOM + 9)
#define TK_PROPERTY_END (TK_CUSTOM + 10)
#define TK_MYSQL_HINT (TK_CUSTOM + 11)
#define TK_NOT_HANDLED (TK_CUSTOM + 12)

View File

@ -231,6 +231,9 @@ HEX_DIGIT [0-9a-fA-F]
"CETUS_SEQUENCE" return TK_CETUS_SEQUENCE;
"CETUS_VERSION" return TK_CETUS_VERSION;
"WARNINGS" return TK_WARNINGS;
"_binary" return TK_UNDERSCORE_CHARSET;
"_latin1" return TK_UNDERSCORE_CHARSET;
"_utf8" return TK_UNDERSCORE_CHARSET;
[0-9]+ return TK_INTEGER; /*sign symbol is handled in parser*/
0[xX]{HEX_DIGIT}+ return TK_INTEGER;

View File

@ -907,6 +907,9 @@ idlist(A) ::= nm(Y).
concat_str(A) ::= STRING(A).
concat_str(A) ::= concat_str(A) STRING. // TODO: collect all
%type text_literal {sql_token_t}
text_literal(A) ::= UNDERSCORE_CHARSET STRING(X). { A = X; }
/////////////////////////// sql_expression Processing /////////////////////////////
//
%include {
@ -966,6 +969,7 @@ expr(A) ::= nm(X) DOT nm(Y) DOT nm(Z). {
}
term(A) ::= INTEGER|FLOAT|BIN_NUM|HEX_NUM|BLOB(X). {A = sql_expr_new(@X, &X);}
term(A) ::= concat_str(X). {A = sql_expr_new(TK_STRING, &X);} //TODO: span error
term(A) ::= text_literal(X). {A = sql_expr_new(TK_NOT_HANDLED, &X);}
expr(A) ::= VARIABLE(X). {A = sql_expr_new(@X, &X);}
expr(A) ::= expr(A) COLLATE ID|STRING(X). {
sql_expr_t* coll = sql_expr_new(@X, &X);

View File

@ -329,7 +329,7 @@ columnname ::= nm typetoken.
DUPLICATE INTERVAL TIME_UNIT SHARD_EXPLAIN
COLUMNS FIELDS COMMENT_KW SHARE MODE TABLES LOCAL
ISOLATION LEVEL COMMITTED UNCOMMITTED SERIALIZABLE REPEATABLE
XA RECOVER WARNINGS
XA RECOVER WARNINGS UNDERSCORE_CHARSET
// all terminals in the full parser should be here, so that the
// generated header is compatible
// these keywords are recognized but not parsed as is