diff options
author | Ken Moore <moorekou@gmail.com> | 2016-08-03 17:51:34 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-08-03 17:51:34 -0400 |
commit | f46167521bfed9718698abe671ace7c5d9adbd9e (patch) | |
tree | 8ca8b681436997cf3b8860d1bbf15f382a986f97 /src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp | |
parent | Start cleaning up the rst syntax highlighting. (diff) | |
download | lumina-f46167521bfed9718698abe671ace7c5d9adbd9e.tar.gz lumina-f46167521bfed9718698abe671ace7c5d9adbd9e.tar.bz2 lumina-f46167521bfed9718698abe671ace7c5d9adbd9e.zip |
Get a lot more of the .rst file syntax highlighting functional.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp index 327d4738..10eec73d 100644 --- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp @@ -163,19 +163,26 @@ void Custom_Syntax::loadRules(QString type){ rule.format.setFontWeight(QFont::Normal); rule.pattern = QRegExp( "\"[^\"\\\\]*(\\\\(.|\\n)[^\"\\\\]*)*\"|'[^'\\\\]*(\\\\(.|\\n)[^'\\\\]*)*'"); rules << rule; + //TODO + rule = SyntaxRule(); //reset rule + rule.format.setFontWeight( QFont::Bold ); + rule.pattern = QRegExp("\\bTODO\\b"); + rules << rule; //Functions - rule.format.setForeground( QColor(settings->value("colors/function").toString()) ); - rule.pattern = QRegExp("\\b[A-Za-z0-9_]+(?=\\()"); + rule = SyntaxRule(); //reset rule + rule.format.setBackground( QColor(settings->value("colors/function").toString()) ); + rule.pattern = QRegExp("^(\\s*)\\.\\.(\\s*)\\b_[a-zA-Z0-9]*:(\\s|$)"); rules << rule; - //Comment (single line) - rule.format.setForeground( QColor(settings->value("colors/comment").toString()) ); - rule.pattern = QRegExp("^(\\s*)\\.\\.\\s(?![\\w-_\\.]+::(\\s|$))"); + //figures and other statements + rule = SyntaxRule(); //reset rule + rule.format.setForeground( QColor(settings->value("colors/function").toString()) ); + rule.pattern = QRegExp("^(\\s*)\\.\\.\\sfigure::\\s"); rules << rule; //Comment (multi-line) - /*SyntaxRuleSplit srule; + SyntaxRuleSplit srule; srule.format.setForeground( QColor(settings->value("colors/comment").toString()) ); - srule.startPattern = QRegExp("^[..]\\s[^_]"); - srule.endPattern = QRegExp("^[^\\s]"); - splitrules << srule;*/ + srule.startPattern = QRegExp("^(\\s*)\\.\\.\\s[^_](?![\\w-_\\.]+::(\\s|$))"); + srule.endPattern = QRegExp("^(?=([^\\.\\s]|$))"); + splitrules << srule; } } |