mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Detect and colourise comments in the SQL syntax highlighter
This commit is contained in:
@@ -61,14 +61,17 @@ SQLiteSyntaxHighlighter::SQLiteSyntaxHighlighter(QTextDocument *parent) :
|
||||
highlightingRules.append(rule);
|
||||
}
|
||||
|
||||
quotationFormat.setForeground(Qt::darkRed);
|
||||
singleLineCommentFormat.setForeground(Qt::darkGreen);
|
||||
rule.pattern = QRegExp("--[^\n]*");
|
||||
rule.format = singleLineCommentFormat;
|
||||
highlightingRules.append(rule);
|
||||
|
||||
quotationFormat.setForeground(Qt::red);
|
||||
rule.pattern = QRegExp("\".*\"");
|
||||
rule.pattern.setMinimal(true);
|
||||
rule.format = quotationFormat;
|
||||
highlightingRules.append(rule);
|
||||
|
||||
rule.pattern = QRegExp("'.*'");
|
||||
rule.pattern.setMinimal(true);
|
||||
rule.format = quotationFormat;
|
||||
highlightingRules.append(rule);
|
||||
}
|
||||
|
||||
@@ -25,12 +25,8 @@ private:
|
||||
QVector<HighlightingRule> highlightingRules;
|
||||
QVector<HighlightingRule> tableNameRules;
|
||||
|
||||
QRegExp commentStartExpression;
|
||||
QRegExp commentEndExpression;
|
||||
|
||||
QTextCharFormat keywordFormat;
|
||||
QTextCharFormat singleLineCommentFormat;
|
||||
QTextCharFormat multiLineCommentFormat;
|
||||
QTextCharFormat quotationFormat;
|
||||
QTextCharFormat tableFormat;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user