improve json syntax highlighting

This commit is contained in:
nightwing 2012-05-26 22:22:40 +04:00
commit c870641506

View file

@ -49,8 +49,12 @@ var JsonHighlightRules = function() {
this.$rules = {
"start" : [
{
token : "variable", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
regex : '"',
next : "string"
}, {
token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b"
@ -76,6 +80,26 @@ var JsonHighlightRules = function() {
token : "text",
regex : "\\s+"
}
],
"string" : [
{
token : "constant.language.escape",
regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/
}, {
token : "string",
regex : '[^"\\\\]+',
merge : true
}, {
token : "string",
regex : '"',
next : "start",
merge : true
}, {
token : "string",
regex : "",
next : "start",
merge : true
}
]
};