From b39a2418ffb8f64bdf6eaabf29b45d8c374ec3fc Mon Sep 17 00:00:00 2001 From: APTX Date: Sat, 31 Aug 2013 20:00:45 +0200 Subject: [PATCH] Better color scheme for the AniAdd script syntax highlighter --- .../aniaddsyntaxhighlighter.cpp | 23 +++++++++++++++++-- .../aniaddsyntaxhighlighter.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/localmylist-management/aniaddsyntaxhighlighter.cpp b/localmylist-management/aniaddsyntaxhighlighter.cpp index 187d72c..853a9dd 100644 --- a/localmylist-management/aniaddsyntaxhighlighter.cpp +++ b/localmylist-management/aniaddsyntaxhighlighter.cpp @@ -11,7 +11,7 @@ AniAddSyntaxHighlighter::AniAddSyntaxHighlighter(QObject *parent) : QSyntaxHighlighter(parent) { HighlightingRule rule; - +/* variable.setForeground( QColor(211, 54, 130)); builtinVariable.setForeground( QColor(220, 50, 47)); function.setForeground( QColor( 38, 139, 210)); @@ -20,6 +20,19 @@ AniAddSyntaxHighlighter::AniAddSyntaxHighlighter(QObject *parent) : string.setForeground( QColor(133, 153, 0)); operatorFormat.setForeground( Qt::darkRed); comment.setForeground( Qt::gray); +*/ + variable.setForeground( Qt::black); + outputVariable.setForeground( Qt::black); + builtinVariable.setForeground( QColor(0x00, 0x6E, 0x28)); + function.setForeground( QColor(0x00, 0x95, 0xFF)); + builtinFunction.setForeground( QColor(0x00, 0x57, 0xAE)); + number.setForeground( QColor(0xB0, 0x80, 0x00)); + string.setForeground( QColor(0xBF, 0x03, 0x03)); + operatorFormat.setForeground( Qt::black); + comment.setForeground( Qt::gray); + + comment.setFontItalic(true); + outputVariable.setFontWeight(QFont::Black); rule.pattern = QRegExp("0|[1-9][0-9]*"); rule.format = number; @@ -31,7 +44,7 @@ AniAddSyntaxHighlighter::AniAddSyntaxHighlighter(QObject *parent) : rule.format = variable; highlightingRules << rule; - rule.pattern = QRegExp("\\$\\s*" + name); + rule.pattern = QRegExp("\\$\\s*" + name + "|" + name + "(?=\\s*\\([^)]+\\)\\s+:=)"); rule.format = function; highlightingRules << rule; @@ -45,6 +58,12 @@ AniAddSyntaxHighlighter::AniAddSyntaxHighlighter(QObject *parent) : rule.format = builtinVariable; highlightingRules.append(rule); } + { + QString outputVariables = "FileName|PathName"; + rule.pattern = QRegExp("\\b(?:" + outputVariables + ")\\b"); + rule.format = outputVariable; + highlightingRules << rule; + } { const QStringList functions = RenameParser::RenameEngine::registeredFunctions(); diff --git a/localmylist-management/aniaddsyntaxhighlighter.h b/localmylist-management/aniaddsyntaxhighlighter.h index df09e17..7929e63 100644 --- a/localmylist-management/aniaddsyntaxhighlighter.h +++ b/localmylist-management/aniaddsyntaxhighlighter.h @@ -26,6 +26,7 @@ private: QTextCharFormat builtinVariable; QTextCharFormat builtinFunction; QTextCharFormat variable; + QTextCharFormat outputVariable; QTextCharFormat function; QTextCharFormat comment; QTextCharFormat operatorFormat; -- 2.52.0