aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--include/SciLexer.h1
-rw-r--r--include/Scintilla.iface1
-rw-r--r--lexers/LexCoffeeScript.cxx19
4 files changed, 13 insertions, 12 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index e8f59c12e..61a6a3c36 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -492,6 +492,10 @@
Released 3 August 2015.
</li>
<li>
+ CoffeeScript lexer adds lexical class for instance properties and fixes some cases of regex highlighting.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1749/">Bug #1749</a>.
+ </li>
+ <li>
VHDL folder supports "protected" keyword.
</li>
<li>
diff --git a/include/SciLexer.h b/include/SciLexer.h
index 034060a4b..57c15cb33 100644
--- a/include/SciLexer.h
+++ b/include/SciLexer.h
@@ -1567,6 +1567,7 @@
#define SCE_COFFEESCRIPT_COMMENTBLOCK 22
#define SCE_COFFEESCRIPT_VERBOSE_REGEX 23
#define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24
+#define SCE_COFFEESCRIPT_INSTANCEPROPERTY 25
#define SCE_AVS_DEFAULT 0
#define SCE_AVS_COMMENTBLOCK 1
#define SCE_AVS_COMMENTBLOCKN 2
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index b835cd4ec..9d83372aa 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -4415,6 +4415,7 @@ val SCE_COFFEESCRIPT_TRIPLEVERBATIM=21
val SCE_COFFEESCRIPT_COMMENTBLOCK=22
val SCE_COFFEESCRIPT_VERBOSE_REGEX=23
val SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT=24
+val SCE_COFFEESCRIPT_INSTANCEPROPERTY=25
# Lexical states for SCLEX_AVS
lex AVS=SCLEX_AVS SCE_AVS_
val SCE_AVS_DEFAULT=0
diff --git a/lexers/LexCoffeeScript.cxx b/lexers/LexCoffeeScript.cxx
index 34ad716e9..2c3a8802c 100644
--- a/lexers/LexCoffeeScript.cxx
+++ b/lexers/LexCoffeeScript.cxx
@@ -58,8 +58,7 @@ static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) {
return false;
}
-static bool followsReturnKeyword(StyleContext &sc, Accessor &styler) {
- // Don't look at styles, so no need to flush.
+static bool followsKeyword(StyleContext &sc, Accessor &styler) {
Sci_Position pos = (Sci_Position) sc.currentPos;
Sci_Position currentLine = styler.GetLine(pos);
Sci_Position lineStartPos = styler.LineStart(currentLine);
@@ -69,15 +68,8 @@ static bool followsReturnKeyword(StyleContext &sc, Accessor &styler) {
break;
}
}
- const char *retBack = "nruter";
- const char *s = retBack;
- while (*s
- && pos >= lineStartPos
- && styler.SafeGetCharAt(pos) == *s) {
- s++;
- pos--;
- }
- return !*s;
+ styler.Flush();
+ return styler.StyleAt(pos) == SCE_COFFEESCRIPT_WORD;
}
static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
@@ -146,6 +138,8 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length
sc.ChangeState(SCE_COFFEESCRIPT_WORD2);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_COFFEESCRIPT_GLOBALCLASS);
+ } else if (sc.LengthCurrent() > 0 && s[0] == '@') {
+ sc.ChangeState(SCE_COFFEESCRIPT_INSTANCEPROPERTY);
}
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
@@ -153,6 +147,7 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length
case SCE_COFFEESCRIPT_WORD:
case SCE_COFFEESCRIPT_WORD2:
case SCE_COFFEESCRIPT_GLOBALCLASS:
+ case SCE_COFFEESCRIPT_INSTANCEPROPERTY:
if (!setWord.Contains(sc.ch)) {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
@@ -239,7 +234,7 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length
sc.Forward();
} else if (sc.ch == '/'
&& (setOKBeforeRE.Contains(chPrevNonWhite)
- || followsReturnKeyword(sc, styler))
+ || followsKeyword(sc, styler))
&& (!setCouldBePostOp.Contains(chPrevNonWhite)
|| !FollowsPostfixOperator(sc, styler))) {
sc.SetState(SCE_COFFEESCRIPT_REGEX); // JavaScript's RegEx