summaryrefslogtreecommitdiff
path: root/src/plugins/cmakeprojectmanager/cmakehighlighter.cpp
diff options
context:
space:
mode:
authordt <qtc-committer@nokia.com>2010-03-30 12:58:58 +0200
committerdt <qtc-committer@nokia.com>2010-03-30 12:58:58 +0200
commit6b389129af20c9f17b5e30e73361e096bf1f4f6c (patch)
tree7f5676c348966c19d453296457f012c9ac56b83e /src/plugins/cmakeprojectmanager/cmakehighlighter.cpp
parent4d0580881392f90523404b29e1edf46474b32dc0 (diff)
downloadqt-creator-6b389129af20c9f17b5e30e73361e096bf1f4f6c.tar.gz
Coding style fixes
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakehighlighter.cpp')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakehighlighter.cpp66
1 files changed, 24 insertions, 42 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakehighlighter.cpp b/src/plugins/cmakeprojectmanager/cmakehighlighter.cpp
index ffe14305b2..b42a570586 100644
--- a/src/plugins/cmakeprojectmanager/cmakehighlighter.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakehighlighter.cpp
@@ -39,11 +39,9 @@ using namespace CMakeProjectManager::Internal;
static bool isVariable(const QString &word)
{
- if (word.length() < 4) { // must be at least "${.}"
- return false;
- }
-
- return word.startsWith("${") && word.endsWith('}');
+ if (word.length() < 4) // must be at least "${.}"
+ return false;
+ return word.startsWith("${") && word.endsWith('}');
}
@@ -65,44 +63,34 @@ void CMakeHighlighter::highlightBlock(const QString &text)
const QChar c = text.at(i);
if (inCommentMode) {
setFormat(i, 1, m_formats[CMakeCommentFormat]);
- }
- else {
+ } else {
if (c == '#') {
if (!inStringMode) {
inCommentMode = true;
setFormat(i, 1, m_formats[CMakeCommentFormat]);
buf.clear();
- }
- else {
+ } else {
buf += c;
}
- }
- else if (c == '(') {
+ } else if (c == '(') {
if (!inStringMode) {
- if (!buf.isEmpty()) {
+ if (!buf.isEmpty())
setFormat(i - buf.length(), buf.length(), m_formats[CMakeFunctionFormat]);
- }
buf.clear();
+ } else {
+ buf += c;
}
- else {
- buf += c;
- }
- }
- else if (c.isSpace()) {
- if (!inStringMode) {
+ } else if (c.isSpace()) {
+ if (!inStringMode)
buf.clear();
- }
- else {
+ else
buf += c;
- }
- }
- else if (c == '\"') {
+ } else if (c == '\"') {
buf += c;
if (inStringMode) {
setFormat(i + 1 - buf.length(), buf.length(), m_formats[CMakeStringFormat]);
buf.clear();
- }
- else {
+ } else {
setFormat(i, 1, m_formats[CMakeStringFormat]);
}
inStringMode = !inStringMode;
@@ -116,24 +104,19 @@ void CMakeHighlighter::highlightBlock(const QString &text)
setFormat(i, 1, emptyFormat);
buf += c;
}
- }
- else if (c == '$') {
- if (inStringMode) {
- setFormat(i - buf.length(), buf.length(), m_formats[CMakeStringFormat]);
- }
- buf.clear();
- buf += c;
- setFormat(i, 1, emptyFormat);
- }
- else if (c == '}') {
+ } else if (c == '$') {
+ if (inStringMode)
+ setFormat(i - buf.length(), buf.length(), m_formats[CMakeStringFormat]);
+ buf.clear();
buf += c;
- if (isVariable(buf))
- {
+ setFormat(i, 1, emptyFormat);
+ } else if (c == '}') {
+ buf += c;
+ if (isVariable(buf)) {
setFormat(i + 1 - buf.length(), buf.length(), m_formats[CMakeVariableFormat]);
buf.clear();
}
- }
- else {
+ } else {
buf += c;
setFormat(i, 1, emptyFormat);
}
@@ -143,8 +126,7 @@ void CMakeHighlighter::highlightBlock(const QString &text)
if (inStringMode) {
setFormat(i - buf.length(), buf.length(), m_formats[CMakeStringFormat]);
setCurrentBlockState(1);
- }
- else {
+ } else {
setCurrentBlockState(0);
}
}