address review comments
This commit is contained in:
parent
65b2cf2855
commit
89b9a8ac72
2 changed files with 9 additions and 7 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)\b/, "(?:start|begin)")
|
.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(?:start|begin)\b/, "end")
|
.replace(/\b(?:start|begin)\b/, "(?:start|begin|end)")
|
||||||
+ ")+"
|
+ ")+"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
tool/lib.js
12
tool/lib.js
|
|
@ -12,11 +12,13 @@ exports.parsePlist = function(xmlOrJSON, callback) {
|
||||||
plist.parseString(xmlOrJSON, function(_, result) {
|
plist.parseString(xmlOrJSON, function(_, result) {
|
||||||
json = result[0];
|
json = result[0];
|
||||||
});
|
});
|
||||||
} else try {
|
} else {
|
||||||
xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
|
try {
|
||||||
json = JSON.parse(xmlOrJSON)
|
xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
|
||||||
} catch(e) {
|
json = JSON.parse(xmlOrJSON)
|
||||||
json = cson.parse(xmlOrJSON);
|
} catch(e) {
|
||||||
|
json = cson.parse(xmlOrJSON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
callback && callback(json);
|
callback && callback(json);
|
||||||
return json;
|
return json;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue