Merge pull request #2461 from ajaxorg/highlighter

Fix highlighter issues
This commit is contained in:
Lennart Kats 2015-04-23 07:38:28 +02:00
commit b6f7e5d6a1
7 changed files with 35 additions and 25 deletions

View file

@ -117,7 +117,7 @@ function BracketMatch() {
typeRe = new RegExp(
"(\\.?" +
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(
"(\\.?" +
token.type.replace(".", "\\.").replace("lparen", ".paren")
.replace(/\b(?:end|start|begin)\b/, "")
.replace(/\b(?:start|begin)\b/, "(?:start|begin|end)")
+ ")+"
);
}

View file

@ -10,10 +10,9 @@
],[
"start",
["keyword.source.rust","fn"],
["meta.function.source.rust"," "],
["text"," "],
["entity.name.function.source.rust","main"],
["meta.function.source.rust","("],
["text",") {"]
["text","() {"]
],[
"start",
["text"," "],
@ -88,10 +87,14 @@
],[
"start",
["keyword.source.rust","fn"],
["meta.function.source.rust"," "],
["entity.name.function.source.rust","map<T, U>"],
["meta.function.source.rust","("],
["text","vector: &[T]"],
["text"," "],
["entity.name.function.source.rust","map"],
["keyword.operator","<"],
["text","T"],
["keyword.operator",","],
["text"," U"],
["keyword.operator",">"],
["text","(vector: &[T]"],
["keyword.operator",","],
["text"," function: &fn(v: &T) "],
["keyword.operator","->"],

View file

@ -65,7 +65,7 @@ var HtmlHighlightRules = function() {
include : "tag_whitespace"
}, {
token : "entity.other.attribute-name.xml",
regex : "[-_a-zA-Z0-9:]+"
regex : "[-_a-zA-Z0-9:.]+"
}, {
token : "keyword.operator.attribute-equals.xml",
regex : "=",
@ -89,7 +89,7 @@ var HtmlHighlightRules = function() {
return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
"meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
},
regex : "(</?)([-_a-zA-Z0-9:]+)",
regex : "(</?)([-_a-zA-Z0-9:.]+)",
next: "tag_stuff"
}],
tag_stuff: [

View file

@ -84,9 +84,8 @@ var RustHighlightRules = function() {
{ token: 'constant.character.escape.source.rust',
regex: stringEscape },
{ defaultToken: 'string.quoted.double.source.rust' } ] },
{ token: [ 'keyword.source.rust', 'meta.function.source.rust',
'entity.name.function.source.rust', 'meta.function.source.rust' ],
regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_][\\w\\:,+ \\\'<>]*)(\\s*\\()' },
{ token: [ 'keyword.source.rust', 'text', 'entity.name.function.source.rust' ],
regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_]*)' },
{ token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
{ 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' },

View file

@ -35,8 +35,10 @@ var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var XmlHighlightRules = function(normalize) {
var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
// http://www.w3.org/TR/REC-xml/#NT-NameChar
// 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 = {
start : [

View file

@ -1,6 +1,7 @@
var plist = require("plist");
var util = require("util");
var url = require("url");
var cson = require("cson");
var https = require("https");
var http = require("http");
@ -12,8 +13,12 @@ exports.parsePlist = function(xmlOrJSON, callback) {
json = result[0];
});
} else {
xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
json = JSON.parse(xmlOrJSON)
try {
xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
json = JSON.parse(xmlOrJSON)
} catch(e) {
json = cson.parse(xmlOrJSON);
}
}
callback && callback(json);
return json;

View file

@ -1,9 +1,10 @@
{
"name": "ace-tools",
"version": "0.1.0",
"dependencies": {
"plist": "",
"css-parse": "1.0.3",
"css-stringify": "1.0.3"
}
"name": "ace-tools",
"version": "0.1.0",
"dependencies": {
"cson": "^3.0.1",
"css-parse": "1.0.3",
"css-stringify": "1.0.3",
"plist": ""
}
}