Merge pull request #499 from tiresiasfromthebai/fix-syntax-highlighting

Fix string and class-name syntax highlighting rules
This commit is contained in:
Ernie Pasveer
2026-07-29 08:22:44 -05:00
committed by GitHub
4 changed files with 24 additions and 18 deletions
+2 -2
View File
@@ -55,7 +55,7 @@ void SeerAdaSourceHighlighter::setHighlighterSettings(const SeerHighlighterSetti
// Set class format and expression.
// (Ada typically doesn't have a distinguished class case convention, but we can reuse uppercase Start)
rule.pattern = QRegularExpression(QStringLiteral("\\b[A-Z][A-z0-9_]*\\b"));
rule.pattern = QRegularExpression(QStringLiteral("\\b[A-Z][A-Za-z0-9_]*\\b"));
rule.format = _classFormat;
_highlightingRules.append(rule);
@@ -74,7 +74,7 @@ void SeerAdaSourceHighlighter::setHighlighterSettings(const SeerHighlighterSetti
}
// Set quote format and expression.
rule.pattern = QRegularExpression(QStringLiteral("\".*\""));
rule.pattern = QRegularExpression(QStringLiteral("\"[^\"]*\""));
rule.format = _quotationFormat;
_highlightingRules.append(rule);
+7 -5
View File
@@ -79,11 +79,6 @@ void SeerCppSourceHighlighter::setHighlighterSettings (const SeerHighlighterSett
rule.format = _classFormat;
_highlightingRules.append(rule);
// Set quote format and expression.
rule.pattern = QRegularExpression(QStringLiteral("\".*\""));
rule.format = _quotationFormat;
_highlightingRules.append(rule);
// Set function format and expression.
rule.pattern = QRegularExpression(QStringLiteral("\\b[A-Za-z0-9_]+(?=\\s*\\()"));
rule.format = _functionFormat;
@@ -96,6 +91,13 @@ void SeerCppSourceHighlighter::setHighlighterSettings (const SeerHighlighterSett
_highlightingRules.append(rule);
}
// Set quote format and expression. This rule must come after the function
// and keyword rules so that string contents keep the quote format (same
// order as the Ada highlighter).
rule.pattern = QRegularExpression(QStringLiteral("\"[^\"]*\""));
rule.format = _quotationFormat;
_highlightingRules.append(rule);
// Set single line comment format and expression.
rule.pattern = QRegularExpression(QStringLiteral("//[^\n]*"));
rule.format = _singleLineCommentFormat;
+7 -5
View File
@@ -67,11 +67,6 @@ void SeerOdinSourceHighlighter::setHighlighterSettings (const SeerHighlighterSet
rule.format = _classFormat;
_highlightingRules.append(rule);
// Set quote format and expression.
rule.pattern = QRegularExpression(QStringLiteral("\".*\""));
rule.format = _quotationFormat;
_highlightingRules.append(rule);
// Set function format and expression.
rule.pattern = QRegularExpression(QStringLiteral("\\b[A-Za-z0-9_]+(?=\\s*\\()"));
rule.format = _functionFormat;
@@ -84,6 +79,13 @@ void SeerOdinSourceHighlighter::setHighlighterSettings (const SeerHighlighterSet
_highlightingRules.append(rule);
}
// Set quote format and expression. This rule must come after the function
// and keyword rules so that string contents keep the quote format (same
// order as the Ada highlighter).
rule.pattern = QRegularExpression(QStringLiteral("\"[^\"]*\""));
rule.format = _quotationFormat;
_highlightingRules.append(rule);
// Set single line comment format and expression.
rule.pattern = QRegularExpression(QStringLiteral("//[^\n]*"));
rule.format = _singleLineCommentFormat;
+8 -6
View File
@@ -57,15 +57,10 @@ void SeerRustSourceHighlighter::setHighlighterSettings(const SeerHighlighterSett
HighlightingRule rule;
// Set class format and expression.
rule.pattern = QRegularExpression(QStringLiteral("\\b[A-Z][A-z0-9_]*\\b"));
rule.pattern = QRegularExpression(QStringLiteral("\\b[A-Z][A-Za-z0-9_]*\\b"));
rule.format = _classFormat;
_highlightingRules.append(rule);
// Set quote format and expression.
rule.pattern = QRegularExpression(QStringLiteral("\".*\""));
rule.format = _quotationFormat;
_highlightingRules.append(rule);
// Set function format and expression.
rule.pattern = QRegularExpression(QStringLiteral("\\b[A-Za-z0-9_!]+(?=\\s*\\()"));
rule.format = _functionFormat;
@@ -78,6 +73,13 @@ void SeerRustSourceHighlighter::setHighlighterSettings(const SeerHighlighterSett
_highlightingRules.append(rule);
}
// Set quote format and expression. This rule must come after the function
// and keyword rules so that string contents keep the quote format (same
// order as the Ada highlighter).
rule.pattern = QRegularExpression(QStringLiteral("\"[^\"]*\""));
rule.format = _quotationFormat;
_highlightingRules.append(rule);
// Set single line comment format and expression.
rule.pattern = QRegularExpression(QStringLiteral("//[^\n]*"));
rule.format = _singleLineCommentFormat;