1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 18:18:53 +08:00

Rewrite reg exp: make them work in Safari #52

This commit is contained in:
lana-k
2021-05-17 21:34:24 +02:00
parent aa52048d51
commit e7d1398546

View File

@@ -127,10 +127,10 @@ function getAst (sql) {
// It throws an error if tokenizer has an arguments: // It throws an error if tokenizer has an arguments:
// https://github.com/codeschool/sqlite-parser/issues/59 // https://github.com/codeschool/sqlite-parser/issues/59
const fixedSql = sql const fixedSql = sql
.replace(/(?<=tokenize=.+)"tokenchars=.+"/, '') .replace(/(tokenize=[^,]+)"tokenchars=.+?"/, '$1')
.replace(/(?<=tokenize=.+)"remove_diacritics=.+"/, '') .replace(/(tokenize=[^,]+)"remove_diacritics=.+?"/, '$1')
.replace(/(?<=tokenize=.+)"separators=.+"/, '') .replace(/(tokenize=[^,]+)"separators=.+?"/, '$1')
.replace(/tokenize=.+(?=(,|\)))/, 'tokenize=unicode61') .replace(/tokenize=.+?(,|\))/, 'tokenize=unicode61$1')
return sqliteParser(fixedSql) return sqliteParser(fixedSql)
} }