aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2015-04-04 14:41:10 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2015-04-04 14:41:10 -0400
commitb5f93b05578293d1d233b4920a28a5c2fd826f94 (patch)
tree82332679f647e9c76e331206786d07a58dcfa9b8 /SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp
parentaf8a7a3e3dccf9c9ad257e3952173d180c8a7421 (diff)
parenta5b034d4a9c44f9bc1e83b01de82530f8fc63013 (diff)
Merge tag 'upstream/3.0.4'
Upstream version 3.0.4 # gpg: Signature made Sat 04 Apr 2015 02:41:09 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/parsercontext.cpp')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp30
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)