ui: Fixed syntax highlighting for Java annotations

This commit is contained in:
Eberhard Graether
2018-08-24 15:51:22 +02:00
parent 1ba1b9f967
commit f7e67c8a63
+4 -1
View File
@@ -52,6 +52,7 @@ void QtHighlighter::createHighlightingRules()
<< "short" << "void"; << "short" << "void";
QRegExp directiveRegExp = QRegExp("#[a-z]+\\b"); QRegExp directiveRegExp = QRegExp("#[a-z]+\\b");
QRegExp annotationRegExp = QRegExp("@[A-Za-z0-9_]+");
QRegExp numberRegExp = QRegExp("\\b[0-9]+\\b"); QRegExp numberRegExp = QRegExp("\\b[0-9]+\\b");
QRegExp functionRegExp = QRegExp("\\b[A-Za-z0-9_]+(?=\\()"); QRegExp functionRegExp = QRegExp("\\b[A-Za-z0-9_]+(?=\\()");
QRegExp stringQuotationRegExp = QRegExp("\"([^\"]|\\\\.)*\""); QRegExp stringQuotationRegExp = QRegExp("\"([^\"]|\\\\.)*\"");
@@ -64,17 +65,19 @@ void QtHighlighter::createHighlightingRules()
s_textFormat.setForeground(QColor(scheme->getSyntaxColor("normal").c_str())); s_textFormat.setForeground(QColor(scheme->getSyntaxColor("normal").c_str()));
QColor directiveColor(scheme->getSyntaxColor("directive").c_str()); QColor directiveColor(scheme->getSyntaxColor("directive").c_str());
QColor annotationColor = directiveColor;
QColor keywordColor(scheme->getSyntaxColor("keyword").c_str()); QColor keywordColor(scheme->getSyntaxColor("keyword").c_str());
QColor typeColor(scheme->getSyntaxColor("type").c_str()); QColor typeColor(scheme->getSyntaxColor("type").c_str());
QColor numberColor(scheme->getSyntaxColor("number").c_str()); QColor numberColor(scheme->getSyntaxColor("number").c_str());
QColor functionColor(scheme->getSyntaxColor("function").c_str()); QColor functionColor(scheme->getSyntaxColor("function").c_str());
QColor quotationColor(scheme->getSyntaxColor("quotation").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.clear();
s_highlightingRules.append(HighlightingRule(directiveColor, directiveRegExp)); s_highlightingRules.append(HighlightingRule(directiveColor, directiveRegExp));
s_highlightingRules.append(HighlightingRule(numberColor, numberRegExp)); s_highlightingRules.append(HighlightingRule(numberColor, numberRegExp));
s_highlightingRules.append(HighlightingRule(functionColor, functionRegExp)); s_highlightingRules.append(HighlightingRule(functionColor, functionRegExp));
s_highlightingRules.append(HighlightingRule(annotationColor, annotationRegExp));
s_highlightingRules.append(HighlightingRule(quotationColor, tagQuotationRegExp)); s_highlightingRules.append(HighlightingRule(quotationColor, tagQuotationRegExp));
s_highlightingRulesCpp.clear(); s_highlightingRulesCpp.clear();