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>
This commit is contained in:
Anton Kalmykov
2014-06-21 14:31:06 +04:00
committed by Nikolai Kosjar
parent 2982a763ac
commit 496cfdd21d
12 changed files with 52 additions and 24 deletions

View File

@@ -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)) {