Skip to content

Commit cd17bae

Browse files
willyvvumarijnh
authored andcommitted
[coffeescript mode] Add support for more obscure syntax
- Using `@` as `this` - `and=` and `&&=` - `or=` and `||=` - `?=`
1 parent aebb9e3 commit cd17bae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mode/coffeescript/coffeescript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CodeMirror.defineMode("coffeescript", function(conf) {
2222
return new RegExp("^((" + words.join(")|(") + "))\\b");
2323
}
2424

25-
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?)/;
25+
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/;
2626
var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/;
2727
var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/;
2828
var properties = /^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*/;
@@ -34,7 +34,7 @@ CodeMirror.defineMode("coffeescript", function(conf) {
3434
"switch", "try", "catch", "finally", "class"];
3535
var commonKeywords = ["break", "by", "continue", "debugger", "delete",
3636
"do", "in", "of", "new", "return", "then",
37-
"this", "throw", "when", "until", "extends"];
37+
"this", "@", "throw", "when", "until", "extends"];
3838

3939
var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
4040

0 commit comments

Comments
 (0)