tabs to spaces

This commit is contained in:
Fabian Jakobs 2011-02-22 22:45:30 +01:00
commit 7a7f9d0f69

View file

@ -65,102 +65,102 @@ var JavaScriptHighlightRules = function() {
this.$rules = { this.$rules = {
"start" : [ "start" : [
{ {
token : "comment", token : "comment",
regex : "\\/\\/.*$" regex : "\\/\\/.*$"
}, },
docComment.getStartRule("doc-start"), docComment.getStartRule("doc-start"),
{ {
token : "comment", // multi line comment token : "comment", // multi line comment
regex : "\\/\\*", regex : "\\/\\*",
next : "comment" next : "comment"
}, { }, {
token : "string.regexp", token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
}, { }, {
token : "string", // single line token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, { }, {
token : "string", // multi line string start token : "string", // multi line string start
regex : '["].*\\\\$', regex : '["].*\\\\$',
next : "qqstring" next : "qqstring"
}, { }, {
token : "string", // single line token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, { }, {
token : "string", // multi line string start token : "string", // multi line string start
regex : "['].*\\\\$", regex : "['].*\\\\$",
next : "qstring" next : "qstring"
}, { }, {
token : "constant.numeric", // hex token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b" regex : "0[xX][0-9a-fA-F]+\\b"
}, { }, {
token : "constant.numeric", // float token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, { }, {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : "(?:true|false)\\b" regex : "(?:true|false)\\b"
}, { }, {
token : function(value) { token : function(value) {
if (value == "this") if (value == "this")
return "variable.language"; return "variable.language";
else if (keywords.hasOwnProperty(value)) else if (keywords.hasOwnProperty(value))
return "keyword"; return "keyword";
else if (buildinConstants.hasOwnProperty(value)) else if (buildinConstants.hasOwnProperty(value))
return "constant.language"; return "constant.language";
else if (futureReserved.hasOwnProperty(value)) else if (futureReserved.hasOwnProperty(value))
return "invalid.illegal"; return "invalid.illegal";
else if (value == "debugger") else if (value == "debugger")
return "invalid.deprecated"; return "invalid.deprecated";
else else
return "identifier"; return "identifier";
}, },
// TODO: Unicode escape sequences // TODO: Unicode escape sequences
// TODO: Unicode identifiers // TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
}, { }, {
token : "lparen", token : "lparen",
regex : "[[({]" regex : "[[({]"
}, { }, {
token : "rparen", token : "rparen",
regex : "[\\])}]" regex : "[\\])}]"
}, { }, {
token : "text", token : "text",
regex : "\\s+" regex : "\\s+"
} }
], ],
"comment" : [ "comment" : [
{ {
token : "comment", // closing comment token : "comment", // closing comment
regex : ".*?\\*\\/", regex : ".*?\\*\\/",
next : "start" next : "start"
}, { }, {
token : "comment", // comment spanning whole line token : "comment", // comment spanning whole line
regex : ".+" regex : ".+"
} }
], ],
"qqstring" : [ "qqstring" : [
{ {
token : "string", token : "string",
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"', regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
next : "start" next : "start"
}, { }, {
token : "string", token : "string",
regex : '.+' regex : '.+'
} }
], ],
"qstring" : [ "qstring" : [
{ {
token : "string", token : "string",
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'", regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
next : "start" next : "start"
}, { }, {
token : "string", token : "string",
regex : '.+' regex : '.+'
} }
] ]
}; };