File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11
22// source: https://www.regextester.com/?fam=110716
3- const REGEX = / ( \b (?: s e l e c t | f r o m | w h e r e | g r o u p | b y | o r d e r | o r | a n d | n o t | e x i s t s | h a v i n g | j o i n | l e f t | r i g h t | i n n e r ) \b ) | ( [ A - Z a - z ] [ A - Z a - z 0 - 9 ] * ) | ( [ 0 - 9 ] + \. [ 0 - 9 ] * ) | ( [ 0 - 9 ] + ) | ( ' [ ^ ' ] * ' ) | ( \s + ) | ( \- \- [ ^ \n \r ] * ) | ( [ + \- \* / . = \( \) , ; ] ) / gmi;
3+ const REGEX = / ( \b (?: s e l e c t | f r o m | w h e r e | g r o u p | b y | o r d e r | o r | a n d | n o t | e x i s t s | h a v i n g | j o i n | l e f t | r i g h t | i n n e r ) \b ) | ( [ A - Z a - z ] [ A - Z a - z 0 - 9 ] * ) | ( [ 0 - 9 ] + \. [ 0 - 9 ] * ) | ( [ 0 - 9 ] + ) | ( ' [ ^ ' ] * ' ) | ( \s + ) | ( \- \- [ ^ \n \r ] * ) | ( [ + \- \* / . = \( \) , ; ] ) | ( . ) / gmi;
44
55export type Token = {
6- type : 'keyword' | 'identifier' | 'operator' | 'string' | 'integer' | 'decimal' | 'comment' | 'whitespace'
6+ type : 'keyword' | 'identifier' | 'operator' | 'string' | 'integer' | 'decimal' | 'comment' | 'whitespace' | 'unknown'
77 text : string
88}
99
@@ -16,7 +16,8 @@ const TOKEN_TYPES_BY_GROUP_INDEX: Array<Token['type'] | undefined> = [
1616 'string' ,
1717 'whitespace' ,
1818 'comment' ,
19- 'operator'
19+ 'operator' ,
20+ 'unknown'
2021]
2122
2223export function tokenize ( sql : string ) {
You can’t perform that action at this time.
0 commit comments