diff options
| author | 2015-04-04 14:41:04 -0400 | |
|---|---|---|
| committer | 2015-04-04 14:41:04 -0400 | |
| commit | a5b034d4a9c44f9bc1e83b01de82530f8fc63013 (patch) | |
| tree | 7a358206c4aff9c33df1752c92eafec97cee2244 /SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp | |
| parent | 306d6d3ca9c9ad774d19135681a7f9805f77035f (diff) | |
Imported Upstream version 3.0.4upstream/3.0.4
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp index e9444e5..7f8ad7a 100644 --- a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp @@ -164,6 +164,36 @@ const QList<ParserError *> &ParserContext::getErrors() return errors; } +QVariant *ParserContext::handleNumberToken(const QString &tokenValue) +{ + recentNumberIsCandidateForMaxNegative = false; + if (tokenValue.startsWith("0x", Qt::CaseInsensitive)) + { + bool ok; + qint64 i64 = tokenValue.toLongLong(&ok, 16); + if (!ok) + { + quint64 ui64 = tokenValue.toULongLong(&ok, 16); + i64 = static_cast<qint64>(ui64); + } + return new QVariant(i64); + } + else if (tokenValue == "9223372036854775808") // max negative longlong value, but without a sign + { + recentNumberIsCandidateForMaxNegative = true; + return new QVariant(static_cast<qint64>(0L)); + } + else + { + return new QVariant(QVariant(tokenValue).toLongLong()); + } +} + +bool ParserContext::isCandidateForMaxNegativeNumber() const +{ + return recentNumberIsCandidateForMaxNegative; +} + void ParserContext::cleanUp() { foreach (ParserError* err, errors) |
