3d89ddc517
lexer: handle escape under no_backslash_SQL mode ( #31111 )
...
close pingcap/tidb#31119
2021-12-29 18:07:50 +08:00
7647c2b9b0
parser: parse gbk encoding SQL token by token instead of the whole SQL ( #31039 )
...
close pingcap/tidb#30765
2021-12-28 22:07:49 +08:00
b4df7ca4dc
test: make all the tests run in serial ( #30692 )
2021-12-14 18:06:36 +08:00
9a780a2138
parser: migrate test-infra to testify ( #29087 )
2021-10-27 19:28:49 +08:00
94e30df8e2
parser: fix compiling, add unit tests ( #28700 )
2021-10-11 23:15:25 +08:00
99525690f1
[parser] Implement interface for acquiring literal value ( #1350 )
2021-10-09 14:53:23 +08:00
3ed80be1c4
[parser] restore: support restoring SQL wrapping with TiDB special comments ( #1287 )
2021-10-09 14:53:23 +08:00
bc860cdd5e
[parser] *: fix static check report ( #1195 )
...
* ast: base.go
Signed-off-by: xhe <xw897002528@gmail.com >
* ast: expressions.go
Signed-off-by: xhe <xw897002528@gmail.com >
* ast: misc_test.go
Signed-off-by: xhe <xw897002528@gmail.com >
* *: digester.go
Signed-off-by: xhe <xw897002528@gmail.com >
* goyacc: format_yacc.go
Signed-off-by: xhe <xw897002528@gmail.com >
* *: lexer_test.go
Signed-off-by: xhe <xw897002528@gmail.com >
* *: misc.go
Signed-off-by: xhe <xw897002528@gmail.com >
* model: model.go
Signed-off-by: xhe <xw897002528@gmail.com >
* model: model_test.go
Signed-off-by: xhe <xw897002528@gmail.com >
* *: parser_test.go
Signed-off-by: xhe <xw897002528@gmail.com >
* test_driver: test_driver_datum.go
Signed-off-by: xhe <xw897002528@gmail.com >
* test_driver: test_driver_mydecimal.go
Signed-off-by: xhe <xw897002528@gmail.com >
* ast: ddl.go, bugfix
Signed-off-by: xhe <xw897002528@gmail.com >
* mysql: errcode.go
charset/charset.go is passing errcode to NewStd, which requires int. But
here codes are uint16. To get rid of the error, uint16 is removed.
Signed-off-by: xhe <xw897002528@gmail.com >
* model: better test
Signed-off-by: xhe <xw897002528@gmail.com >
* *: fix timezone
Signed-off-by: xhe <xw897002528@gmail.com >
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com >
2021-10-09 14:53:23 +08:00
5e0bbb8eb8
[parser] lexer: treat dot differently in different context ( #1132 )
...
* fix lexer
* fix lexer
* fix lexer
* fix lexer
* fix lexer
* update test
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com >
2021-10-09 14:53:23 +08:00
dcc137315f
[parser] fix: string(int) expression not allowed on Go1.15 ( #1003 )
...
Make test will fail due to Go1.15 starts to not allow "string(int)" expression.
Fix affected sources by replace such expression to legal expressions.
More info about ban string(int), see: https://github.com/golang/go/issues/3939
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com >
2021-10-09 14:53:23 +08:00
6cd14a0c30
[parser] lexer: replace version comments with feature-ids mechanism ( #777 )
...
* lexer: replace version comments with feature-ids mechanism
* tests: retain the original version digit test
* fix scanVersionDigits
* add SpecialCommentsController to decide what comments can be parsed
* only ignore comments with unsupported feature-id
* remove debug log
2021-10-09 14:53:23 +08:00
fcace6539d
[parser] misc: correct TiDB-style executable comment version for auto_random ( #748 )
...
Co-authored-by: kennytm <kennytm@gmail.com >
2021-10-09 14:53:23 +08:00
5cfb690491
[parser] Rewrite special comment parser ( #711 )
...
* lexer: added a function to scan version digits
* lexer: removed special comment scanner
Instead, simply strip off '/*!' and the pairing '*/'.
Temporarily disabled handling of /*+ ... */
* lexer: support collecting the entire /*+ ... */ as a single token
This new token has type `hintComment`. The actual hint will be parsed
lazily.
* lexer,yy_parser: move lastErrorAsWarn() from Parser into Scanner
* goyacc: do not allow conflict, support changing parser type name
change the "DO NOT EDIT" line to fit the Go standard
* parser,hintparser: created a new parser just for parsing optimizer hints
deleted all optimizer hint rules from parser.go
refactor the Makefile to support building both parsers (also deleted some
outdated fixup of *parser.go)
* lexer: fix comment parser
* codecov: don't wait for integration test before showing the coverage
* lexer: fix comment parsing again
* hintparser: TiDB still expects `HASH_JOIN(@qb1 foo@qb2)` to be valid :(
* parser,hintparser: provide the true line/column offset in the warnings
cache the hintparser in the main parser to avoid repeated allocation
* lexer: delete unused sqlOffsetInComment()
2021-10-09 14:53:23 +08:00
385d05ce3e
[parser] parser: support syntax for AUTO_RANDOM ( #571 )
2021-10-09 14:53:23 +08:00
d2debf2fdf
[parser] parse until eof ( #367 )
2021-10-09 14:53:23 +08:00
01abdb1fbd
[parser] parser: fix lexer that treat 9eTSs as a float ( #208 )
2021-10-09 14:53:23 +08:00
433fd2d301
[parser] lexer: recognize "@@system var" and fix start offset of "@user var" ( #112 )
2021-10-09 14:53:23 +08:00
c270f55405
[parser] *: move github.com/pingcap/tidb/parser here ( #1 )
2021-10-09 14:53:23 +08:00
89dda9d9a8
*: move parser to a separate repository ( #8036 )
2018-10-25 11:12:10 +08:00
a18d27ea14
parser: fix single line comment end with newline ( #7612 )
2018-09-05 10:29:11 +08:00
fd3706148f
lexer: support more syntaxes regarding 'SET Syntax' ( #7020 )
2018-07-10 18:20:33 +08:00
ca7403a814
parser: refactor parser step2 ( #4652 )
...
Refactor expression syntax to use MySQL naming and structure.
Partially fix issue #4026
2017-09-29 15:34:03 +08:00
dd06221d71
parser: refactor parser first step ( #4545 )
...
* parser: refactor parser first step
This is the first step to refactor parser. it solve several problems.
1. function name can be general identifier, we don't need to define a keyword for a builtin function.
2. write test to make sure keyword is consistent with lever token. this fixes #4538 .
3. Removed ReservedKeyword, solve the identifier in scanner.
4. Simplified precedence definition.
* *: address comment
2017-09-18 21:04:00 +08:00
e6283e9fc6
parser: fix #4354 , support empty bit-value literal syntax b'' ( #4370 )
2017-08-30 10:03:34 +08:00
fce58065d7
parser,plan,ast: fix #4239 , concatenates string literals which placed each other, and use first string as projection name ( #4252 )
2017-08-21 12:37:27 +08:00
161c532025
parser: (partially) fix float point parsing with leading dot ( #3964 )
2017-08-01 22:28:48 +08:00
2745333435
parser,plan: support \N shortcut for null ( #3943 )
2017-08-01 14:16:43 +08:00
0aa27c3d3d
lexer: fix panic when input "'\\" ( #3948 )
...
* lexer: fix panic when input "'\\"
2017-07-31 11:35:36 +08:00
76cc17ebf7
parser: support username without quotes ( #3742 )
2017-07-15 10:16:24 +08:00
8f79c2031b
parser: change intLit to decLit when the value out of range ( #2954 )
2017-03-29 23:16:48 +08:00
6d58b5c6ec
parser: parse /*+ */ for optimizer hint ( #2904 )
2017-03-21 14:47:21 +08:00
ecb01eb3af
parser: handle the national character set like N'literal' ( #2773 )
2017-03-06 19:08:54 +08:00
849ec6c63e
parser: support ANSI_QUOTES sql mode ( #2754 )
...
In ANSI_QUOTES sql mode, "xxx" is parsed to identifier,
similar to `xxx` in normal sql mode
* fix typo
2017-03-01 13:45:19 +08:00
2594e4f799
parser: parse use 10 instead 0 ( #2404 )
2017-01-06 11:29:55 +08:00
8a03344d05
*: deprecate DateArithInterval ( #2368 )
2017-01-04 11:42:59 +08:00
5917a784be
parser: fix .1_t_1_x parsed as .1 _t_1_x ( #2210 )
...
it should not be parsed as a .1(float) and _t_1_x(identifier)
instead, it should be .(dot) 1_t_1_x(identifier)
2016-12-09 11:47:46 +08:00
f15333b8c7
parser: fix bug 0_x should parse to identifier ( #2200 )
2016-12-08 17:14:15 +08:00
ca700d2c75
parser: fix wrong offset for token inner mysql comment ( #2141 )
2016-11-30 22:29:07 +08:00
91050ff1f8
parser: parse decimal literal instead of float literal ( #2044 )
...
Improves MySQL compatibility.
2016-11-21 19:29:25 +08:00
94b5d1001f
parser: handle MySQL-specific-code comment syntax in parser ( #2018 )
...
* parser: handle MySQL-specific-code comment syntax in parser
fix issue 2017
2016-11-17 10:47:21 +08:00
3b8bf2135c
parser: tiny clean up ( #1992 )
...
rename scanner_test.go to lexer_test.go
make the code more robust when unicode.ReplacementChar appears
2016-11-13 15:20:01 +08:00