]> Some of my projects - localmylist.git/commitdiff
Better color scheme for the AniAdd script syntax highlighter
authorAPTX <marek321@gmail.com>
Sat, 31 Aug 2013 18:00:45 +0000 (20:00 +0200)
committerAPTX <marek321@gmail.com>
Sat, 31 Aug 2013 18:00:45 +0000 (20:00 +0200)
localmylist-management/aniaddsyntaxhighlighter.cpp
localmylist-management/aniaddsyntaxhighlighter.h

index 187d72c7ef0982b345a42e3cb8ed204eb359fcd6..853a9ddfe8e467a6fc475c940fdbfe804683a8c7 100644 (file)
@@ -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();
 
index df09e17c5ef34faf047b62d75ddfa14b46b63acd..7929e635b7da58ad8db578024c508fb3fa005222 100644 (file)
@@ -26,6 +26,7 @@ private:
        QTextCharFormat builtinVariable;
        QTextCharFormat builtinFunction;
        QTextCharFormat variable;
+       QTextCharFormat outputVariable;
        QTextCharFormat function;
        QTextCharFormat comment;
        QTextCharFormat operatorFormat;