aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexRuby.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'lexers/LexRuby.cxx')
-rw-r--r--lexers/LexRuby.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/lexers/LexRuby.cxx b/lexers/LexRuby.cxx
index 0fdbab7d1..b0b52fd77 100644
--- a/lexers/LexRuby.cxx
+++ b/lexers/LexRuby.cxx
@@ -882,6 +882,31 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
preferRE = false;
} else if (isSafeWordcharOrHigh(chNext)) {
state = SCE_RB_SYMBOL;
+ } else if ((chNext == '@' || chNext == '$') &&
+ isSafeWordcharOrHigh(chNext2)) {
+ // instance and global variable followed by an identifier
+ advance_char(i, ch, chNext, chNext2);
+ state = SCE_RB_SYMBOL;
+ } else if (((chNext == '@' && chNext2 == '@') ||
+ (chNext == '$' && chNext2 == '-')) &&
+ isSafeWordcharOrHigh(styler.SafeGetCharAt(i+3))) {
+ // class variables and special global variable "$-IDENTCHAR"
+ state = SCE_RB_SYMBOL;
+ // $-IDENTCHAR doesn't continue past the IDENTCHAR
+ if (chNext == '$') {
+ styler.ColourTo(i+3, SCE_RB_SYMBOL);
+ state = SCE_RB_DEFAULT;
+ }
+ i += 3;
+ chNext = styler.SafeGetCharAt(i+1);
+ chNext2 = styler.SafeGetCharAt(i+2);
+ } else if (chNext == '$' && strchr("_~*$?!@/\\;,.=:<>\"&`'+", chNext2)) {
+ // single-character special global variables
+ i += 2;
+ ch = chNext2;
+ chNext = styler.SafeGetCharAt(i+1);
+ styler.ColourTo(i, SCE_RB_SYMBOL);
+ state = SCE_RB_DEFAULT;
} else if (strchr("[*!~+-*/%=<>&^|", chNext)) {
// Do the operator analysis in-line, looking ahead
// Based on the table in pickaxe 2nd ed., page 339