diff options
| author | Alon Levy <alon@pobox.com> | 2015-01-13 11:35:57 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-01-13 11:35:57 +0200 |
| commit | 24f7c4453ef193e8a817d52bab02206a1c2c61d7 (patch) | |
| tree | 4ccc6f2c03811953e953b1a3b795a074be344c8c /src | |
| parent | 0bf945e1f6796a0af53149682e225540ad64a3f2 (diff) | |
client/textanalysis: use constant for 'new node'
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/textanalysis.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client/textanalysis.js b/src/client/textanalysis.js index 14f66486..6c1a773d 100644 --- a/src/client/textanalysis.js +++ b/src/client/textanalysis.js @@ -21,6 +21,8 @@ var ANALYSIS_NODE_START = 'ANALYSIS_NODE_START'; var ANALYSIS_NODE = 'ANALYSIS_NODE' var ANALYSIS_LINK = 'ANALYSIS_LINK'; +var NEW_NODE_NAME = "new node"; + function selectedType() { return nodetypes[typeindex]; @@ -330,11 +332,11 @@ var textAnalyser = function (spec) { //FINAL N ORDER switch (orderStack[orderStack.length - 1]) { case START: - __addNode("new node"); + __addNode(NEW_NODE_NAME); if (!starGraph && nodeindex > 0) { - __addLink(token_set_new_node_names[nodeindex - 1], "new node", + __addLink(token_set_new_node_names[nodeindex - 1], NEW_NODE_NAME, token_set_new_link_names[linkindex], "temp"); - and_connect("new node"); + and_connect(NEW_NODE_NAME); } ret.state = ANALYSIS_NODE_START; break; @@ -350,10 +352,10 @@ var textAnalyser = function (spec) { break; case LINK: linkindex++; - __addNode("new node", selectedType(), "temp"); + __addNode(NEW_NODE_NAME, selectedType(), "temp"); if (!starGraph) { - __addLink(token_set_new_node_names[nodeindex - 1], "new node", token_set_new_link_names[linkindex], "temp"); - and_connect("new node"); + __addLink(token_set_new_node_names[nodeindex - 1], NEW_NODE_NAME, token_set_new_link_names[linkindex], "temp"); + and_connect(NEW_NODE_NAME); } ret.state = ANALYSIS_LINK; break; @@ -466,7 +468,7 @@ var textAnalyser = function (spec) { for (; tokens[i] !== undefined && tokens[i].token === '#'; ++i) {} // go back to find token for (j = i; j >= 0 && tokens[j] === undefined || tokens[j].token !== '#'; --j) {} - name = tokens[j + 1] ? tokens[j + 1].token : 'new node'; + name = tokens[j + 1] ? tokens[j + 1].token : NEW_NODE_NAME; node = edit_graph.find_node__by_name(name); if (node === undefined) { // return the first node by default |
