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