diff --git a/src/InjectionVisualizer/lexer.ts b/src/InjectionVisualizer/lexer.ts index 033003b..60cb85c 100644 --- a/src/InjectionVisualizer/lexer.ts +++ b/src/InjectionVisualizer/lexer.ts @@ -1,9 +1,9 @@ // source: https://www.regextester.com/?fam=110716 -const REGEX = /(\b(?:select|from|where|group|by|order|or|and|not|exists|having|join|left|right|inner)\b)|([A-Za-z][A-Za-z0-9]*)|([0-9]+\.[0-9]*)|([0-9]+)|('[^']*')|(\s+)|(\-\-[^\n\r]*)|([+\-\*/.=\(\),;])/gmi; +const REGEX = /(\b(?:select|from|where|group|by|order|or|and|not|exists|having|join|left|right|inner)\b)|([A-Za-z][A-Za-z0-9]*)|([0-9]+\.[0-9]*)|([0-9]+)|('[^']*')|(\s+)|(\-\-[^\n\r]*)|([+\-\*/.=\(\),;])|(.)/gmi; export type Token = { - type: 'keyword' | 'identifier' | 'operator' | 'string' | 'integer' | 'decimal' | 'comment' | 'whitespace' + type: 'keyword' | 'identifier' | 'operator' | 'string' | 'integer' | 'decimal' | 'comment' | 'whitespace' | 'unknown' text: string } @@ -16,7 +16,8 @@ const TOKEN_TYPES_BY_GROUP_INDEX: Array = [ 'string', 'whitespace', 'comment', - 'operator' + 'operator', + 'unknown' ] export function tokenize(sql: string) {