Commit df0102df authored by Leandro Melo's avatar Leandro Melo
Browse files

Gen. highlighter: Improve performance (delimiters)

Make lookup for a delimiter a bit faster.
parent b5739e36
......@@ -40,11 +40,14 @@ using namespace TextEditor;
using namespace Internal;
HighlightDefinition::HighlightDefinition() :
m_delimiters(QLatin1String(".():!+,-<=>%&/;?[]^{|}~\\*, \t")),
m_singleLineCommentAfterWhiteSpaces(false),
m_keywordCaseSensitivity(Qt::CaseSensitive),
m_indentationBasedFolding(false)
{}
{
QString s(QLatin1String(".():!+,-<=>%&/;?[]^{|}~\\*, \t"));
foreach (const QChar &c, s)
m_delimiters.insert(c);
}
HighlightDefinition::~HighlightDefinition()
{}
......@@ -147,7 +150,7 @@ void HighlightDefinition::addDelimiters(const QString &characters)
{
for (int i = 0; i < characters.length(); ++i) {
if (!m_delimiters.contains(characters.at(i)))
m_delimiters.append(characters.at(i));
m_delimiters.insert(characters.at(i));
}
}
......
......@@ -32,6 +32,7 @@
#include <QtCore/QString>
#include <QtCore/QHash>
#include <QtCore/QSet>
#include <QtCore/QSharedPointer>
namespace TextEditor {
......@@ -102,8 +103,6 @@ private:
QString m_initialContext;
QString m_delimiters;
QString m_singleLineComment;
bool m_singleLineCommentAfterWhiteSpaces;
......@@ -114,6 +113,8 @@ private:
Qt::CaseSensitivity m_keywordCaseSensitivity;
bool m_indentationBasedFolding;
QSet<QChar> m_delimiters;
};
} // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment