X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FDocTag.js;h=b7f25ca4ebbc9b6a7f7cf34147ba718749e5d516;hp=e5449ab1f2e77a56b988fc1ae6f06de6f219f841;hb=HEAD;hpb=b1378d60e48bd1f2dafa16075647b3236dc1c893 diff --git a/JSDOC/DocTag.js b/JSDOC/DocTag.js index e5449ab..b7f25ca 100644 --- a/JSDOC/DocTag.js +++ b/JSDOC/DocTag.js @@ -26,6 +26,7 @@ DocTag = XObject.define( this.isOptional = false; this.defaultValue = ""; this.desc = ""; + this.optvalues = false; if (typeof src != "undefined") { this.parse(src); } @@ -39,12 +40,42 @@ DocTag = XObject.define( isOptional : false, defaultValue : '', desc : '', - /* qdump needed for cahcing? - toQDump :function(t) + /** + * serialize.. + */ + toJSON :function(t) { - return JSDOC.toQDump(t, 'JSDOC.DocTag.fromDump({', '})', new JSDOC.DocTag()); - } , - */ + var ret = { '*object' : 'DocTag' }; + + for (var i in this) { + if (i == 'optvalues') { + ret[i] = this.optvalues; + continue; + } + + switch (typeof(this[i])) { + case 'function': + continue; + continue; + + case 'string': + case 'number': + case 'boolean': + ret[i] = this[i]; continue; + + + + default: + + print("unknown type: (" + i + ")" + typeof(this[i])); + this.toJSON = null; + print(JSON.stringify(this));; + Seed.quit(); + } + } + return ret; + }, + /** @@ -71,6 +102,26 @@ DocTag = XObject.define( if (Options.LOG) Options.LOG.warn(e); else throw e; } + + // if type == @cfg, and matches (|....|...) + + src = src.trim(); + if (this.title == "cfg" && src.match(/^\([^)]+\)/)) { + var m = src.match(/^\(([^)]+)\)/); + print(m); + if (m[1].match(/\|/)) { + var opts = m[1].trim().split(/\s*\|\s*/); + this.optvalues = opts; + src = src.substring(m[0].length).trim(); + print(src); + + + } + + + } + + this.desc = src; // whatever is left // example tags need to have whitespace preserved