X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FDocTag.js;h=296eea8e872a437831fed050829f1f3862ec9241;hb=7b90a14b811e7d787afa5ffde75baac2ae1e17d2;hp=d9fa27bd9dca456df98e5663a5aa9b00484adada;hpb=69191889a5f601a74e5b1560f63cabd23b0e5be9;p=gnome.introspection-doc-generator diff --git a/JSDOC/DocTag.js b/JSDOC/DocTag.js index d9fa27b..296eea8 100644 --- a/JSDOC/DocTag.js +++ b/JSDOC/DocTag.js @@ -13,6 +13,12 @@ Options = imports.Options.Options; DocTag = XObject.define( + +/** + * @constructor + * @arg {String} src + */ + function(src) { this.title = ""; this.type = ""; @@ -164,6 +170,29 @@ DocTag = XObject.define( return src; } + + balance : function(str, open, close) { + var i = 0; + while (str.charAt(i) != open) { + if (i == str.length) return [-1, -1]; + i++; + } + + var j = i+1; + var balance = 1; + while (j < str.length) { + if (str.charAt(j) == open) balance++; + if (str.charAt(j) == close) balance--; + if (balance == 0) break; + j++; + if (j == str.length) return [-1, -1]; + } + + return [i, j]; +} + + + }); // cached support?