Merge pull request #2461 from ajaxorg/highlighter
Fix highlighter issues
This commit is contained in:
commit
b6f7e5d6a1
7 changed files with 35 additions and 25 deletions
|
|
@ -117,7 +117,7 @@ function BracketMatch() {
|
||||||
typeRe = new RegExp(
|
typeRe = new RegExp(
|
||||||
"(\\.?" +
|
"(\\.?" +
|
||||||
token.type.replace(".", "\\.").replace("rparen", ".paren")
|
token.type.replace(".", "\\.").replace("rparen", ".paren")
|
||||||
.replace(/\b(?:end|start|begin)\b/, "")
|
.replace(/\b(?:end)\b/, "(?:start|begin|end)")
|
||||||
+ ")+"
|
+ ")+"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +174,7 @@ function BracketMatch() {
|
||||||
typeRe = new RegExp(
|
typeRe = new RegExp(
|
||||||
"(\\.?" +
|
"(\\.?" +
|
||||||
token.type.replace(".", "\\.").replace("lparen", ".paren")
|
token.type.replace(".", "\\.").replace("lparen", ".paren")
|
||||||
.replace(/\b(?:end|start|begin)\b/, "")
|
.replace(/\b(?:start|begin)\b/, "(?:start|begin|end)")
|
||||||
+ ")+"
|
+ ")+"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,9 @@
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["keyword.source.rust","fn"],
|
["keyword.source.rust","fn"],
|
||||||
["meta.function.source.rust"," "],
|
["text"," "],
|
||||||
["entity.name.function.source.rust","main"],
|
["entity.name.function.source.rust","main"],
|
||||||
["meta.function.source.rust","("],
|
["text","() {"]
|
||||||
["text",") {"]
|
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["text"," "],
|
["text"," "],
|
||||||
|
|
@ -88,10 +87,14 @@
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["keyword.source.rust","fn"],
|
["keyword.source.rust","fn"],
|
||||||
["meta.function.source.rust"," "],
|
["text"," "],
|
||||||
["entity.name.function.source.rust","map<T, U>"],
|
["entity.name.function.source.rust","map"],
|
||||||
["meta.function.source.rust","("],
|
["keyword.operator","<"],
|
||||||
["text","vector: &[T]"],
|
["text","T"],
|
||||||
|
["keyword.operator",","],
|
||||||
|
["text"," U"],
|
||||||
|
["keyword.operator",">"],
|
||||||
|
["text","(vector: &[T]"],
|
||||||
["keyword.operator",","],
|
["keyword.operator",","],
|
||||||
["text"," function: &fn(v: &T) "],
|
["text"," function: &fn(v: &T) "],
|
||||||
["keyword.operator","->"],
|
["keyword.operator","->"],
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ var HtmlHighlightRules = function() {
|
||||||
include : "tag_whitespace"
|
include : "tag_whitespace"
|
||||||
}, {
|
}, {
|
||||||
token : "entity.other.attribute-name.xml",
|
token : "entity.other.attribute-name.xml",
|
||||||
regex : "[-_a-zA-Z0-9:]+"
|
regex : "[-_a-zA-Z0-9:.]+"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator.attribute-equals.xml",
|
token : "keyword.operator.attribute-equals.xml",
|
||||||
regex : "=",
|
regex : "=",
|
||||||
|
|
@ -89,7 +89,7 @@ var HtmlHighlightRules = function() {
|
||||||
return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
|
return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
|
||||||
"meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
|
"meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
|
||||||
},
|
},
|
||||||
regex : "(</?)([-_a-zA-Z0-9:]+)",
|
regex : "(</?)([-_a-zA-Z0-9:.]+)",
|
||||||
next: "tag_stuff"
|
next: "tag_stuff"
|
||||||
}],
|
}],
|
||||||
tag_stuff: [
|
tag_stuff: [
|
||||||
|
|
|
||||||
|
|
@ -84,9 +84,8 @@ var RustHighlightRules = function() {
|
||||||
{ token: 'constant.character.escape.source.rust',
|
{ token: 'constant.character.escape.source.rust',
|
||||||
regex: stringEscape },
|
regex: stringEscape },
|
||||||
{ defaultToken: 'string.quoted.double.source.rust' } ] },
|
{ defaultToken: 'string.quoted.double.source.rust' } ] },
|
||||||
{ token: [ 'keyword.source.rust', 'meta.function.source.rust',
|
{ token: [ 'keyword.source.rust', 'text', 'entity.name.function.source.rust' ],
|
||||||
'entity.name.function.source.rust', 'meta.function.source.rust' ],
|
regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_]*)' },
|
||||||
regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_][\\w\\:,+ \\\'<>]*)(\\s*\\()' },
|
|
||||||
{ token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
|
{ token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
|
||||||
{ token: 'keyword.source.rust',
|
{ token: 'keyword.source.rust',
|
||||||
regex: '\\b(?:as|assert|break|claim|const|do|drop|else|extern|fail|for|if|impl|in|let|log|loop|match|mod|module|move|mut|Owned|priv|pub|pure|ref|return|unchecked|unsafe|use|while|mod|Send|static|trait|class|struct|enum|type)\\b' },
|
regex: '\\b(?:as|assert|break|claim|const|do|drop|else|extern|fail|for|if|impl|in|let|log|loop|match|mod|module|move|mut|Owned|priv|pub|pure|ref|return|unchecked|unsafe|use|while|mod|Send|static|trait|class|struct|enum|type)\\b' },
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,10 @@ var oop = require("../lib/oop");
|
||||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
var XmlHighlightRules = function(normalize) {
|
var XmlHighlightRules = function(normalize) {
|
||||||
|
// http://www.w3.org/TR/REC-xml/#NT-NameChar
|
||||||
var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
|
// NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
||||||
|
// NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
||||||
|
var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
|
||||||
|
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
start : [
|
start : [
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
var plist = require("plist");
|
var plist = require("plist");
|
||||||
var util = require("util");
|
var util = require("util");
|
||||||
var url = require("url");
|
var url = require("url");
|
||||||
|
var cson = require("cson");
|
||||||
|
|
||||||
var https = require("https");
|
var https = require("https");
|
||||||
var http = require("http");
|
var http = require("http");
|
||||||
|
|
@ -12,8 +13,12 @@ exports.parsePlist = function(xmlOrJSON, callback) {
|
||||||
json = result[0];
|
json = result[0];
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
|
try {
|
||||||
json = JSON.parse(xmlOrJSON)
|
xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
|
||||||
|
json = JSON.parse(xmlOrJSON)
|
||||||
|
} catch(e) {
|
||||||
|
json = cson.parse(xmlOrJSON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
callback && callback(json);
|
callback && callback(json);
|
||||||
return json;
|
return json;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
{
|
{
|
||||||
"name": "ace-tools",
|
"name": "ace-tools",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"plist": "",
|
"cson": "^3.0.1",
|
||||||
"css-parse": "1.0.3",
|
"css-parse": "1.0.3",
|
||||||
"css-stringify": "1.0.3"
|
"css-stringify": "1.0.3",
|
||||||
}
|
"plist": ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue