cleanup highlight_rules
This commit is contained in:
parent
ad9b656c14
commit
0918c7f1c0
4 changed files with 17 additions and 9 deletions
|
|
@ -101,6 +101,14 @@ exports.arrayToMap = function(arr) {
|
|||
|
||||
};
|
||||
|
||||
exports.createMap = function(props) {
|
||||
var map = Object.create(null);
|
||||
for (var i in props) {
|
||||
map[i] = props[i];
|
||||
}
|
||||
return map;
|
||||
};
|
||||
|
||||
/*
|
||||
* splice out of 'array' anything that === 'value'
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -39,12 +39,13 @@ define(function(require, exports, module) {
|
|||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var xmlUtil = require("./xml_util");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var tagMap = {
|
||||
var tagMap = lang.createMap({
|
||||
a : 'anchor',
|
||||
button : 'form',
|
||||
form : 'form',
|
||||
|
|
@ -61,7 +62,7 @@ var tagMap = {
|
|||
tfoot : 'table',
|
||||
th : 'table',
|
||||
tr : 'table'
|
||||
};
|
||||
});
|
||||
|
||||
var HtmlHighlightRules = function() {
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ var JsonHighlightRules = function() {
|
|||
"string" : [
|
||||
{
|
||||
token : "constant.language.escape",
|
||||
regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/
|
||||
regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+',
|
||||
|
|
|
|||
|
|
@ -78,13 +78,12 @@ exports.tag = function(states, name, nextState, tagMap) {
|
|||
}, {
|
||||
//token : "meta.tag",
|
||||
|
||||
token : function(value) {
|
||||
if (tagMap && tagMap[value]) {
|
||||
return "meta.tag.tag-name" + '.' + tagMap[value];
|
||||
} else {
|
||||
token : !tagMap ? "meta.tag.tag-name" : function(value) {
|
||||
if (tagMap[value])
|
||||
return "meta.tag.tag-name." + tagMap[value];
|
||||
else
|
||||
return "meta.tag.tag-name";
|
||||
}
|
||||
},
|
||||
},
|
||||
merge : true,
|
||||
regex : "[-_a-zA-Z0-9:]+",
|
||||
next : name + "_embed_attribute_list"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue