aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cpphighlighter.cpp
diff options
context:
space:
mode:
authorAnton Kalmykov <anton.kalmykov@gmail.com>2014-06-21 14:31:06 +0400
committerNikolai Kosjar <nikolai.kosjar@digia.com>2014-06-24 15:44:13 +0200
commit496cfdd21d6a7f862d7909a311f4bae8c3e18ec3 (patch)
tree7fb8ce506077ca4958686479deb76f5bd96cfcf9 /src/plugins/cppeditor/cpphighlighter.cpp
parent2982a763ac69043400e624c2c199344be2b2ba6f (diff)
Add syntax highlight for primitive data types
Syntax highlight rules for keywords are changed to highlight control keywords and primitive data types separately. Change-Id: Ifb25be7a97b92589030aa190641320c233dc7f2d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cppeditor/cpphighlighter.cpp')
-rw-r--r--src/plugins/cppeditor/cpphighlighter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp
index 241619ded0..d7b23b15e7 100644
--- a/src/plugins/cppeditor/cpphighlighter.cpp
+++ b/src/plugins/cppeditor/cpphighlighter.cpp
@@ -52,6 +52,7 @@ CppHighlighter::CppHighlighter(QTextDocument *document) :
<< TextEditor::C_STRING
<< TextEditor::C_TYPE
<< TextEditor::C_KEYWORD
+ << TextEditor::C_PRIMITIVE_TYPE
<< TextEditor::C_OPERATOR
<< TextEditor::C_PREPROCESSOR
<< TextEditor::C_LABEL
@@ -220,6 +221,9 @@ void CppHighlighter::highlightBlock(const QString &text)
|| CppTools::isQtKeyword(text.midRef(tk.utf16charsBegin(), tk.utf16chars()))
|| tk.isObjCAtKeyword()) {
setFormat(tk.utf16charsBegin(), tk.utf16chars(), formatForCategory(CppKeywordFormat));
+ } else if (tk.isPrimitiveType()) {
+ setFormat(tk.utf16charsBegin(), tk.utf16chars(),
+ formatForCategory(CppPrimitiveTypeFormat));
} else if (tk.isOperator()) {
setFormat(tk.utf16charsBegin(), tk.utf16chars(), formatForCategory(CppOperatorFormat));
} else if (i == 0 && tokens.size() > 1 && tk.is(T_IDENTIFIER) && tokens.at(1).is(T_COLON)) {