From 685ba1845162b40e17ffe8e927705de4a19885d3 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Apr 2015 20:05:25 +0400 Subject: [PATCH 1/6] fix #2452 . is a valid XML tagname character --- lib/ace/mode/html_highlight_rules.js | 4 ++-- lib/ace/mode/xml_highlight_rules.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ace/mode/html_highlight_rules.js b/lib/ace/mode/html_highlight_rules.js index 9c9cc36f..4effa2aa 100644 --- a/lib/ace/mode/html_highlight_rules.js +++ b/lib/ace/mode/html_highlight_rules.js @@ -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 : "( Date: Sun, 19 Apr 2015 20:27:07 +0400 Subject: [PATCH 2/6] fix #2441 function highlighting in rust mode --- lib/ace/mode/rust_highlight_rules.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ace/mode/rust_highlight_rules.js b/lib/ace/mode/rust_highlight_rules.js index 181cf11a..056e7a55 100644 --- a/lib/ace/mode/rust_highlight_rules.js +++ b/lib/ace/mode/rust_highlight_rules.js @@ -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' }, From ecb699aa1131052640b122bc1f0f2385bfdb137e Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 16 Apr 2015 16:50:20 +0400 Subject: [PATCH 3/6] support converting from cson --- tool/lib.js | 5 ++++- tool/package.json | 15 ++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tool/lib.js b/tool/lib.js index e72194d7..53f38a75 100644 --- a/tool/lib.js +++ b/tool/lib.js @@ -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"); @@ -11,9 +12,11 @@ exports.parsePlist = function(xmlOrJSON, callback) { plist.parseString(xmlOrJSON, function(_, result) { json = result[0]; }); - } else { + } else try { xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, ""); json = JSON.parse(xmlOrJSON) + } catch(e) { + json = cson.parse(xmlOrJSON); } callback && callback(json); return json; diff --git a/tool/package.json b/tool/package.json index 2d33713a..974673c6 100644 --- a/tool/package.json +++ b/tool/package.json @@ -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": "" + } } From 2008ab813facebe1b250ef951f69442790577be5 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Apr 2015 20:29:28 +0400 Subject: [PATCH 4/6] fix bracket matching in modes imported from textmate --- lib/ace/edit_session/bracket_match.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ace/edit_session/bracket_match.js b/lib/ace/edit_session/bracket_match.js index 064ee3dc..b1638e81 100644 --- a/lib/ace/edit_session/bracket_match.js +++ b/lib/ace/edit_session/bracket_match.js @@ -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)") + ")+" ); } @@ -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/, "end") + ")+" ); } From 65b2cf28550b598d90b342a2a148285ea6db248a Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Apr 2015 20:35:39 +0400 Subject: [PATCH 5/6] update test for rust mode --- lib/ace/mode/_test/tokens_rust.json | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/ace/mode/_test/tokens_rust.json b/lib/ace/mode/_test/tokens_rust.json index 6592575b..8c59a3aa 100644 --- a/lib/ace/mode/_test/tokens_rust.json +++ b/lib/ace/mode/_test/tokens_rust.json @@ -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"], - ["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","->"], From 89b9a8ac7250e2fa0d6fb386a1ca6a7032b087a7 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 20 Apr 2015 18:25:32 +0400 Subject: [PATCH 6/6] address review comments --- lib/ace/edit_session/bracket_match.js | 4 ++-- tool/lib.js | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/ace/edit_session/bracket_match.js b/lib/ace/edit_session/bracket_match.js index b1638e81..62a8499c 100644 --- a/lib/ace/edit_session/bracket_match.js +++ b/lib/ace/edit_session/bracket_match.js @@ -117,7 +117,7 @@ function BracketMatch() { typeRe = new RegExp( "(\\.?" + token.type.replace(".", "\\.").replace("rparen", ".paren") - .replace(/\b(?:end)\b/, "(?:start|begin)") + .replace(/\b(?:end)\b/, "(?:start|begin|end)") + ")+" ); } @@ -174,7 +174,7 @@ function BracketMatch() { typeRe = new RegExp( "(\\.?" + token.type.replace(".", "\\.").replace("lparen", ".paren") - .replace(/\b(?:start|begin)\b/, "end") + .replace(/\b(?:start|begin)\b/, "(?:start|begin|end)") + ")+" ); } diff --git a/tool/lib.js b/tool/lib.js index 53f38a75..8809595c 100644 --- a/tool/lib.js +++ b/tool/lib.js @@ -12,11 +12,13 @@ exports.parsePlist = function(xmlOrJSON, callback) { plist.parseString(xmlOrJSON, function(_, result) { json = result[0]; }); - } else try { - xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, ""); - json = JSON.parse(xmlOrJSON) - } catch(e) { - json = cson.parse(xmlOrJSON); + } else { + try { + xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, ""); + json = JSON.parse(xmlOrJSON) + } catch(e) { + json = cson.parse(xmlOrJSON); + } } callback && callback(json); return json;