diff options
| author | 2016-06-13 18:42:57 -0400 | |
|---|---|---|
| committer | 2016-06-13 18:42:57 -0400 | |
| commit | 65d5f68cc6dc81799c5a5d90400a2c1f0dd02547 (patch) | |
| tree | 6f245ba901b87ef42fed69965aea22f5eea6b590 /SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp | |
| parent | aeb6bad01630d325a4e768e798a7a6d44e18fdaf (diff) | |
| parent | 5d9314f134ddd3dc4c853e398ac90ba247fb2e4f (diff) | |
Merge tag 'upstream/3.1.0'
Upstream version 3.1.0
# gpg: Signature made Mon 13 Jun 2016 06:42:54 PM EDT using RSA key ID EBE9BD91
# gpg: Good signature from "Unit 193 <unit193@gmail.com>"
# gpg: aka "Unit 193 <unit193@ninthfloor.org>"
# gpg: aka "Unit 193 <unit193@ubuntu.com>"
# gpg: aka "Unit 193 <unit193@ninthfloor.com>"
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp index c85b3ba..6be7528 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp @@ -3,6 +3,7 @@ #include "lexer_low_lev.h" #include "sqlite2_parse.h" #include "sqlite3_parse.h" +#include "common/utils_sql.h" #include <QString> #include <QMultiHash> #include <QDebug> @@ -281,11 +282,41 @@ QString Lexer::detokenize(const TokenList& tokens) QString str; foreach (TokenPtr token, tokens) - str += token->value; + str += detokenize(token); return str; } +QString Lexer::detokenize(const TokenPtr& token) +{ + switch (token->type) { + case Token::OTHER: + case Token::CTX_ALIAS: + case Token::CTX_COLLATION: + case Token::CTX_COLUMN: + case Token::CTX_COLUMN_NEW: + case Token::CTX_COLUMN_TYPE: + case Token::CTX_CONSTRAINT: + case Token::CTX_DATABASE: + case Token::CTX_INDEX: + case Token::CTX_INDEX_NEW: + case Token::CTX_TABLE: + case Token::CTX_TABLE_NEW: + case Token::CTX_TRANSACTION: + case Token::CTX_TRIGGER: + case Token::CTX_TRIGGER_NEW: + case Token::CTX_VIEW: + case Token::CTX_VIEW_NEW: + return token->value.isEmpty() ? wrapObjName(token->value, Dialect::Sqlite3, NameWrapper::DOUBLE_QUOTE) : token->value; + case Token::CTX_ERROR_MESSAGE: + case Token::STRING: + return token->value.isEmpty() ? wrapString(token->value) : token->value; + default: + break; + } + return token->value; +} + TokenList Lexer::tokenize(const QString& sql, Dialect dialect) { Lexer lexer(dialect); |
