From f7e67c8a636786f5980d7f67c19dacdcbe7b57b8 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Fri, 24 Aug 2018 15:51:22 +0200 Subject: [PATCH] ui: Fixed syntax highlighting for Java annotations --- src/lib_gui/qt/utility/QtHighlighter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib_gui/qt/utility/QtHighlighter.cpp b/src/lib_gui/qt/utility/QtHighlighter.cpp index b8b66ba0..a7782763 100644 --- a/src/lib_gui/qt/utility/QtHighlighter.cpp +++ b/src/lib_gui/qt/utility/QtHighlighter.cpp @@ -52,6 +52,7 @@ void QtHighlighter::createHighlightingRules() << "short" << "void"; QRegExp directiveRegExp = QRegExp("#[a-z]+\\b"); + QRegExp annotationRegExp = QRegExp("@[A-Za-z0-9_]+"); QRegExp numberRegExp = QRegExp("\\b[0-9]+\\b"); QRegExp functionRegExp = QRegExp("\\b[A-Za-z0-9_]+(?=\\()"); QRegExp stringQuotationRegExp = QRegExp("\"([^\"]|\\\\.)*\""); @@ -64,17 +65,19 @@ void QtHighlighter::createHighlightingRules() s_textFormat.setForeground(QColor(scheme->getSyntaxColor("normal").c_str())); QColor directiveColor(scheme->getSyntaxColor("directive").c_str()); + QColor annotationColor = directiveColor; QColor keywordColor(scheme->getSyntaxColor("keyword").c_str()); QColor typeColor(scheme->getSyntaxColor("type").c_str()); QColor numberColor(scheme->getSyntaxColor("number").c_str()); QColor functionColor(scheme->getSyntaxColor("function").c_str()); QColor quotationColor(scheme->getSyntaxColor("quotation").c_str()); - QColor commentColor = scheme->getSyntaxColor("comment").c_str(); + QColor commentColor(scheme->getSyntaxColor("comment").c_str()); s_highlightingRules.clear(); s_highlightingRules.append(HighlightingRule(directiveColor, directiveRegExp)); s_highlightingRules.append(HighlightingRule(numberColor, numberRegExp)); s_highlightingRules.append(HighlightingRule(functionColor, functionRegExp)); + s_highlightingRules.append(HighlightingRule(annotationColor, annotationRegExp)); s_highlightingRules.append(HighlightingRule(quotationColor, tagQuotationRegExp)); s_highlightingRulesCpp.clear();