Skip to content

Commit

Permalink
object parsing enhancement
Browse files Browse the repository at this point in the history
#1: create 'decorator' registry key for every object with an empty
string value
#2: if a regnode's value is a JSON string, parse it and store as JSON
object
  • Loading branch information
rkereskenyi committed Jul 1, 2013
1 parent 92c4fbd commit e79d8a7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bin/parse_xme.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ define([ "util/assert", "core/tasync", "util/common" ], function (ASSERT, TASYNC

core.setRegistry(tag.node, "metameta", tag.name);
core.setRegistry(tag.node, "isPort", tag.name === "atom");
core.setRegistry(tag.node, "decorator", "");

if (tag.name === "connection") {
core.setRegistry(tag.node, "isConnection", true);
Expand Down Expand Up @@ -300,7 +301,13 @@ define([ "util/assert", "core/tasync", "util/common" ], function (ASSERT, TASYNC

// this actually happens
if (path !== "" && tag.text !== "") {
core.setRegistry(parent.node, path, tag.text);
var val;
try {
val = JSON.parse(tag.text);
} catch (e) {
val = tag.text;
}
core.setRegistry(parent.node, path, val);
}
}
}
Expand Down

0 comments on commit e79d8a7

Please sign in to comment.