From 41136df7888da712d3bf251414f6b43475bd7f2c Mon Sep 17 00:00:00 2001 From: bringert Date: Mon, 22 Jan 2007 20:48:14 +0000 Subject: [PATCH] Rename children to args in VoiceXML/SISR/JavaScript. --- javascript/gflib.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/javascript/gflib.js b/javascript/gflib.js index 583d9087e..621f6364a 100644 --- a/javascript/gflib.js +++ b/javascript/gflib.js @@ -1,7 +1,7 @@ /* Abstract syntax trees */ function Fun(name) { this.name = name; - this.children = copy_arguments(arguments, 1); + this.args = copy_arguments(arguments, 1); } Fun.prototype.print = function () { return this.show(0); } ; Fun.prototype.show = function (prec) { @@ -17,7 +17,7 @@ Fun.prototype.show = function (prec) { } } else { var s = this.name; - var cs = this.children; + var cs = this.args; for (var i in cs) { s += " " + cs[i].show(1); } @@ -27,11 +27,11 @@ Fun.prototype.show = function (prec) { return s; } }; -Fun.prototype.getChild = function (i) { - return this.children[i]; +Fun.prototype.getArg = function (i) { + return this.args[i]; }; -Fun.prototype.setChild = function (i,c) { - this.children[i] = c; +Fun.prototype.setArg = function (i,c) { + this.args[i] = c; }; Fun.prototype.isMeta = function() { return this.name == '?'; @@ -40,8 +40,8 @@ Fun.prototype.isComplete = function() { if (this.isMeta()) { return false; } else { - for (var i in tree.children) { - if (!tree.children[i].isComplete()) { + for (var i in tree.args) { + if (!tree.args[i].isComplete()) { return false; } } @@ -94,8 +94,8 @@ Abstract.prototype.annotate = function(tree, type) { tree.type = type; } else { var typ = this.types[tree.name]; - for (var i in tree.children) { - this.annotate(tree.children[i], typ.args[i]); + for (var i in tree.args) { + this.annotate(tree.args[i], typ.args[i]); } } return tree; @@ -106,10 +106,10 @@ Abstract.prototype.copyTree = function(x) { if (!isUndefined(x.type)) { t.type = x.type; } - var cs = x.children; + var cs = x.args; if (!isUndefined(cs)) { for (var i in cs) { - t.setChild(i, this.copyTree(cs[i])); + t.setArg(i, this.copyTree(cs[i])); } } return t; @@ -131,7 +131,7 @@ Abstract.prototype.parseTree_ = function(tokens, prec) { if (prec == 0) { var c, i; for (i = 0; (c = this.parseTree_(tokens, 1)) !== null; i++) { - tree.setChild(i,c); + tree.setArg(i,c); } } return tree; @@ -162,8 +162,8 @@ Concrete.prototype.linearizeToTerm = function (tree) { } } else { var cs = new Array(); - for (var i in tree.children) { - cs.push(this.linearizeToTerm(tree.children[i])); + for (var i in tree.args) { + cs.push(this.linearizeToTerm(tree.args[i])); } return this.rule(tree.name, cs); }