aboutsummaryrefslogtreecommitdiff
path: root/desktop-utilities/lumina-textedit/syntaxSupport.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-04-22 08:02:09 -0400
committerKen Moore <moorekou@gmail.com>2016-04-22 08:02:09 -0400
commit0bb5d4f6a15838e503734a0c6a275d96c6712098 (patch)
tree8c50b6b1d9e48b7d460e3563460922412b23f8de /desktop-utilities/lumina-textedit/syntaxSupport.cpp
parentFix up the mouse focus when switching tabs around. (diff)
downloadlumina-0bb5d4f6a15838e503734a0c6a275d96c6712098.tar.gz
lumina-0bb5d4f6a15838e503734a0c6a275d96c6712098.tar.bz2
lumina-0bb5d4f6a15838e503734a0c6a275d96c6712098.zip
Add some alternate keywords for the c++ syntax rules (built-in functions: for, while, case, if).
Diffstat (limited to 'desktop-utilities/lumina-textedit/syntaxSupport.cpp')
-rw-r--r--desktop-utilities/lumina-textedit/syntaxSupport.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/desktop-utilities/lumina-textedit/syntaxSupport.cpp b/desktop-utilities/lumina-textedit/syntaxSupport.cpp
index 7be190d2..8e2e347a 100644
--- a/desktop-utilities/lumina-textedit/syntaxSupport.cpp
+++ b/desktop-utilities/lumina-textedit/syntaxSupport.cpp
@@ -55,8 +55,9 @@ void Custom_Syntax::loadRules(QString type){
keywords << "char" << "class" << "const" << "double" << "enum" << "explicit" << "friend" << "inline" \
<< "int" << "long" << "namespace" << "operator" << "private" << "protected" << "public" \
<< "short" << "signals" << "signed" << "slots" << "static" << "struct" << "template" \
- << "typedef" << "typename" << "union" << "unsigned" << "virtual" << "void" << "volatile";
-
+ << "typedef" << "typename" << "union" << "unsigned" << "virtual" << "void" << "volatile" \
+ << "true" << "false";
+
SyntaxRule rule;
rule.format.setForeground( QColor(settings->value("colors/keyword").toString()) );
rule.format.setFontWeight(QFont::Bold);
@@ -64,6 +65,14 @@ void Custom_Syntax::loadRules(QString type){
rule.pattern = QRegExp("\\b"+keywords[i]+"\\b"); //turn each keyword into a QRegExp and insert the rule
rules << rule;
}
+ //Alternate Keywords (built-in functions)
+ keywords.clear();
+ keywords << "for" << "while" << "switch" << "case" << "if";
+ rule.format.setForeground( QColor(settings->value("colors/altkeyword").toString()) );
+ for(int i=0; i<keywords.length(); i++){
+ rule.pattern = QRegExp("\\b"+keywords[i]+"\\b"); //turn each keyword into a QRegExp and insert the rule
+ rules << rule;
+ }
//Class Names
rule.format.setForeground( QColor(settings->value("colors/class").toString()) );
rule.pattern = QRegExp("\\bQ[A-Za-z]+\\b");
@@ -190,4 +199,4 @@ void Custom_Syntax::loadRules(QString type){
//srule.endPattern = QRegExp("\\*/");
//splitrules << srule;
}
-} \ No newline at end of file
+}
bgstack15