update coffeescript highlight rules
This commit is contained in:
parent
49a120990f
commit
7f302bfc2f
1 changed files with 55 additions and 15 deletions
|
|
@ -45,25 +45,28 @@ define(function(require, exports, module) {
|
|||
};
|
||||
|
||||
var keywords = (
|
||||
"this|throw|then|try|typeof|super|switch|return|break|by)|continue|" +
|
||||
"this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
|
||||
"catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" +
|
||||
"finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
|
||||
"or|on|unless|until|and|yes"
|
||||
);
|
||||
|
||||
var langConstant = (
|
||||
"true|false|null|undefined"
|
||||
"true|false|null|undefined|NaN|Infinity"
|
||||
);
|
||||
|
||||
var illegal = (
|
||||
"case|const|default|function|var|void|with|enum|export|implements|" +
|
||||
"interface|let|package|private|protected|public|static|yield|" +
|
||||
"__hasProp|extends|slice|bind|indexOf"
|
||||
"__hasProp|slice|bind|indexOf"
|
||||
);
|
||||
|
||||
var supportClass = (
|
||||
"Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|" +
|
||||
"String|RangeError|SyntaxError|Error|EvalError|TypeError|URIError"
|
||||
"Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
|
||||
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
|
||||
"SyntaxError|TypeError|URIError|" +
|
||||
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
|
||||
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
|
||||
);
|
||||
|
||||
var supportFunction = (
|
||||
|
|
@ -71,26 +74,22 @@ define(function(require, exports, module) {
|
|||
"encodeURIComponent|decodeURI|decodeURIComponent|String|"
|
||||
);
|
||||
|
||||
var variableLanguage = (
|
||||
"window|arguments|prototype|document"
|
||||
);
|
||||
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"keyword": keywords,
|
||||
"constant.language": langConstant,
|
||||
"invalid.illegal": illegal,
|
||||
"language.support.class": supportClass,
|
||||
"language.support.function": supportFunction,
|
||||
"variable.language": variableLanguage
|
||||
}, "identifier");
|
||||
|
||||
this.$rules = {
|
||||
start : [
|
||||
{
|
||||
token : "identifier",
|
||||
regex : "(?:(?:\\.|::)\\s*)" + identifier
|
||||
}, {
|
||||
token : "variable",
|
||||
regex : "@(?:" + identifier + ")?"
|
||||
}, {
|
||||
token: keywordMapper,
|
||||
regex : identifier
|
||||
}, {
|
||||
token : "constant.numeric",
|
||||
regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
|
||||
}, {
|
||||
|
|
@ -134,12 +133,53 @@ define(function(require, exports, module) {
|
|||
}, {
|
||||
token : "comment",
|
||||
regex : "#.*"
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\."
|
||||
}, {
|
||||
//class A extends B
|
||||
token : [
|
||||
"keyword", "text", "language.support.class", "text", "keyword", "text", "language.support.class"
|
||||
],
|
||||
regex : "(class)(\\s+)(" + identifier + ")(\\s+)(extends)(\\s+)(" + identifier + ")"
|
||||
}, {
|
||||
//class A
|
||||
token : [
|
||||
"keyword", "text", "language.support.class"
|
||||
],
|
||||
regex : "(class)(\\s+)(" + identifier + ")"
|
||||
}, {
|
||||
//play = (args) ->
|
||||
//play : (args) ->
|
||||
token : [
|
||||
"entity.name.function", "text", "keyword.operator", "text",
|
||||
"paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"
|
||||
],
|
||||
regex : "(" + identifier + ")(\\s*)(=|:)(\\s*)(\\(?)([^)]*)(\\)?)(\\s*)([-=]>)"
|
||||
}, {
|
||||
//(args) ->
|
||||
token : [
|
||||
"paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"
|
||||
],
|
||||
regex : "(\\()([^)]*)(\\))(\\s*)([\\-=]>)"
|
||||
}, {
|
||||
token : "identifier",
|
||||
regex : "(?:(?:\\.|::)\\s*)" + identifier
|
||||
}, {
|
||||
token : "variable",
|
||||
regex : "@(?:" + identifier + ")?"
|
||||
}, {
|
||||
token: keywordMapper,
|
||||
regex : identifier
|
||||
}, {
|
||||
token : "punctuation.operator",
|
||||
regex : "\\?|\\:|\\,|\\."
|
||||
}, {
|
||||
token : "storage.type",
|
||||
regex : "[\\-=]>"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "(?:[\\-=]>|[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
|
||||
regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[({[]"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue