JSDOC/Symbol.js
[gnome.introspection-doc-generator] / JSDOC / Symbol.js
1 //<script type="text/javascript">
2
3 XObject         = imports.XObject.XObject;
4
5 SymbolSet       = imports.SymbolSet.SymbolSet;
6 //Parser          = imports.Parser.Parser;
7 DocComment      = imports.DocComment.DocComment;
8 DocTag          = imports.DocTag.DocTag;
9 /**
10         Create a new Symbol.
11         @class Represents a symbol in the source code.
12  */
13 Symbol = XObject.define(
14     function() {
15         this.init();
16         if (arguments.length) this.populate.apply(this, arguments);
17         
18     },
19     Object,
20     {
21         
22         
23         name : "",
24         defaultValue : "",
25         params : [],
26         $args : [], // original arguments used when constructing.
27         addOn : "",
28         alias : "",
29         augments : false, // Doctag
30         author : "",
31         classDesc : "",
32         comment : {},
33         deprecated : "",
34         desc : "",
35         events : [],
36         example : "",
37         exceptions : [],
38         inherits : [],
39         inheritsFrom : [],
40         isa : "OBJECT", // OBJECT//FUNCTION
41         isEvent : false,
42         isConstant : false,
43         isIgnored : false,
44         isInner : false,
45         isNamespace : false,
46         isPrivate : false,
47         isStatic : false,
48         memberOf : "",
49         methods : [],
50         _name : "",
51         _params : [],
52         properties : [],
53         requires : [],
54         returns : [],
55         see : [],
56         since : "",
57         srcFile : {},
58         type : "",
59         version : "",
60         childClasses : [],
61         cfgs : {},
62         
63         
64             
65         
66         toObject : function()
67         {
68             
69             function array2object(a , m)
70             {
71                 m = m || false;
72                 var r = [];
73                 a.forEach(function(e) {
74                     r.push(m ? e : e.toObject());
75                 })
76             }
77             
78             var ret = { };
79             for (var i in this) {
80                 if (Symbol.hide.indexOf(i) > -1) {
81                     continue;
82                 }
83                 switch (typeof(this[i])) {
84                     case 'function':
85                         continue;
86                     case 'object':
87                         switch(i) {
88                             //arrays..
89                             case 'params' : 
90                                 ret[i] = array2object(this[i],true); 
91                                 continue;
92                                 
93                             //objects..
94                             case 'augments' : 
95                             case 'comment' :
96                                 print(JSON.stringify(this[i]));
97                                 ret[i] = this[i].toObject();
98                                 continue;
99                                 
100                             default:
101                                 print("object? :" + i);
102                                 Seed.quit();
103                         }
104                         
105                         
106                     case 'string':
107                     case 'number':
108                         ret[i] = this[i]; continue;
109                     default:
110                         print("unknown type:" + typeof(this[i]));
111                         Seed.quit();
112                    }
113             }
114             
115             
116         },
117         
118         init : function() 
119         {
120             // only initialize arrays / objects..
121             this.params = [];
122             this.$args = [];
123             
124             this.events = [];
125             this.exceptions = [];
126             this.inherits = [];
127             this.inheritsFrom = [];
128             this.isa = "OBJECT"; // OBJECT//FUNCTION
129             this.methods = [];
130             this._params = [];
131             this.properties = [];
132             this.requires = [];
133             this.returns = [];
134             this.see = [];
135             this.srcFile = {};
136             this.childClasses = [];
137             this.cfgs = {};
138             
139             this.comment = new DocComment();
140             this.comment.isUserComment =  false;
141             
142                
143         },
144
145         serialize : function() {
146             var keys = [];
147             for (var p in this) {
148                 keys.push (p);
149             }
150             keys = keys.sort();
151             
152             var out = "";
153             for (var i in keys) {
154                 if (typeof this[keys[i]] == "function") continue;
155                 out += "     " +keys[i]+" => "+
156                     (   
157                         (typeof(this[keys[i]]) != "object") ?  
158                             this[keys[i]] :
159                             "[" +typeof(this[keys[i]])+"]"
160                     ) + 
161                     ",\n";
162             }
163             return "\n{\n" + out + "}\n";
164         },
165
166         clone : function() {
167             var clone = new Symbol();
168             clone.populate.apply(clone, this.$args); // repopulate using the original arguments
169             clone.srcFile = this.srcFile; // not the current srcFile, the one when the original was made
170             return clone;
171         },
172
173
174
175
176         //__defineSetter__("name",
177         setName  : function(n) { 
178                 n = n.replace(/^_global_[.#-]/, ""); 
179                 n = n.replace(/\.prototype\.?/g, '#'); 
180                  n = n.replace(/#$/g, ''); 
181                 this._name = n;
182                 this.name = n; // real!
183             },
184         //);
185         //__defineGetter__("name",
186         getName : function() { return this._name; },
187         //);
188         //__defineSetter__("params", 
189         setParams  :function(v) {
190                 for (var i = 0, l = v.length; i < l; i++) {
191                     if (v[i].constructor != DocTag) { // may be a generic object parsed from signature, like {type:..., name:...}
192                         var ty = v[i].hasOwnProperty('type') ? v[i].type : '';
193                         this._params[i] = new DocTag(
194                             "param"+((ty)?" {"+ty+"}":"")+" "+v[i].name);
195                     }
196                     else {
197                         this._params[i] = v[i];
198                     }
199                 }
200                 this.params = this._params;
201             },
202         //);
203
204
205         //__defineGetter__("params",
206         getParams : function() { return this._params; },
207         //);
208
209         populate : function(
210                 /** String */ name,
211                 /** Object[] */ params,
212                 /** String */ isa,
213                 /** DocComment */ comment
214         ) {
215             this.$args = arguments;
216             //println("Symbol created: " + isa + ":" + name);
217             this.setName(name);
218             this.alias = this.getName();
219             this.setParams(params);
220             this.isa = (isa == "VIRTUAL")? "OBJECT":isa;
221             this.comment = comment || new DocComment("");
222             this.srcFile = Symbol.srcFile;
223             
224            
225             
226             if (this.is("FILE") && !this.alias) this.alias = this.srcFile;
227
228             this.setTags();
229             
230             //if (typeof PluginManager != "undefined") {
231             //    PluginManager.run("onSymbol", this);
232             //}
233         },
234
235         setTags : function() {
236             // @author
237             var authors = this.comment.getTag("author");
238             if (authors.length) {
239                 this.author = authors.map(function($){return $.desc;}).join(", ");
240             }
241             
242             /*~t
243                 assert("testing Symbol");
244                 
245                 requires("../lib/JSDOC/DocComment.js");
246                 requires("../frame/String.js");
247                 requires("../lib/JSDOC/DocTag.js");
248
249                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@author Joe Smith*"+"/"));
250                 assertEqual(sym.author, "Joe Smith", "@author tag, author is found.");
251             */
252             // @desc
253             var mth = this.comment.getTag("method");
254             if (mth.length) {
255                 this.isa = "FUNCTION";
256             }
257             // @desc
258             var descs = this.comment.getTag("desc");
259             if (descs.length) {
260                 this.desc = descs.map(function($){return $.desc;}).join("\n"); // multiple descriptions are concatenated into one
261             }
262             
263             /*~t
264                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@desc This is a description.*"+"/"));
265                 assertEqual(sym.desc, "This is a description.", "@desc tag, description is found.");
266             */
267             
268             // @overview
269             if (this.is("FILE")) {
270                 if (!this.alias) this.alias = this.srcFile;
271                 
272                 var overviews = this.comment.getTag("overview");
273                 if (overviews.length) {
274                     this.desc = [this.desc].concat(overviews.map(function($){return $.desc;})).join("\n");
275                 }
276             }
277             
278             /*~t
279                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@overview This is an overview.*"+"/"));
280                 assertEqual(sym.desc, "\nThis is an overview.", "@overview tag, description is found.");
281             */
282             
283             // @since
284             var sinces = this.comment.getTag("since");
285             if (sinces.length) {
286                 this.since = sinces.map(function($){return $.desc;}).join(", ");
287             }
288             
289             /*~t
290                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@since 1.01*"+"/"));
291                 assertEqual(sym.since, "1.01", "@since tag, description is found.");
292             */
293             
294             // @constant
295             if (this.comment.getTag("constant").length) {
296                 this.isConstant = true;
297                 this.isa = 'OBJECT';
298             }
299             
300             /*~t
301                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@constant*"+"/"));
302                 assertEqual(sym.isConstant, true, "@constant tag, isConstant set.");
303             */
304             
305             // @version
306             var versions = this.comment.getTag("version");
307             if (versions.length) {
308                 this.version = versions.map(function($){return $.desc;}).join(", ");
309             }
310             
311             /*~t
312                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@version 2.0x*"+"/"));
313                 assertEqual(sym.version, "2.0x", "@version tag, version is found.");
314             */
315             
316             // @deprecated
317             var deprecateds = this.comment.getTag("deprecated");
318             if (deprecateds.length) {
319                 this.deprecated = deprecateds.map(function($){return $.desc;}).join("\n");
320             }
321             
322             /*~t
323                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@deprecated Use other method.*"+"/"));
324                 assertEqual(sym.deprecated, "Use other method.", "@deprecated tag, desc is found.");
325             */
326             
327             // @example
328             var examples = this.comment.getTag("example");
329             if (examples.length) {
330                 this.example = examples[0];
331             }
332             
333             /*~t
334                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@example This\n  is an example.*"+"/"));
335                 assertEqual(sym.example, "This\n  is an example.", "@deprecated tag, desc is found.");
336             */
337             
338             // @see
339             var sees = this.comment.getTag("see");
340             if (sees.length) {
341                 var thisSee = this.see;
342                 sees.map(function($){thisSee.push($.desc);});
343             }
344             
345             /*~t
346                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@see The other thing.*"+"/"));
347                 assertEqual(sym.see, "The other thing.", "@see tag, desc is found.");
348             */
349             
350             // @class
351             var classes = this.comment.getTag("class");
352             if (classes.length) {
353                 this.isa = "CONSTRUCTOR";
354                 this.classDesc = classes[0].desc; // desc can't apply to the constructor as there is none.
355                 if (!this.classDesc) {
356                     this.classDesc = this.desc;
357                    }
358                 
359                 
360             }
361             
362             /*~t
363                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@class This describes the class.*"+"/"));
364                 assertEqual(sym.isa, "CONSTRUCTOR", "@class tag, makes symbol a constructor.");
365                 assertEqual(sym.classDesc, "This describes the class.", "@class tag, class description is found.");
366             */
367             
368             // @namespace
369             var namespaces = this.comment.getTag("namespace");
370             if (namespaces.length) {
371                 this.classDesc = namespaces[0].desc+"\n"+this.desc; // desc can't apply to the constructor as there is none.
372                 this.isNamespace = true;
373             }
374             
375             /*~t
376                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@namespace This describes the namespace.*"+"/"));
377                 assertEqual(sym.classDesc, "This describes the namespace.\n", "@namespace tag, class description is found.");
378             */
379             
380             // @param
381             var params = this.comment.getTag("param");
382             if (params.length) {
383                 // user-defined params overwrite those with same name defined by the parser
384                 var thisParams = this.getParams();
385
386                 if (thisParams.length == 0) { // none exist yet, so just bung all these user-defined params straight in
387                     this.setParams(params);
388                 }
389                 else { // need to overlay these user-defined params on to existing parser-defined params
390                     for (var i = 0, l = params.length; i < l; i++) {
391                         if (thisParams[i]) {
392                             if (params[i].type) thisParams[i].type = params[i].type;
393                             thisParams[i].name = params[i].name;
394                             thisParams[i].desc = params[i].desc;
395                             thisParams[i].isOptional = params[i].isOptional;
396                             thisParams[i].defaultValue = params[i].defaultValue;
397                         }
398                         else thisParams[i] = params[i];
399                     }
400                 }
401             }
402             
403             /*~t
404                 var sym = new Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new DocComment("/**Description.*"+"/"));
405                 assertEqual(sym.params.length, 1, "parser defined param is found.");
406                 
407                 sym = new Symbol("foo", [], "FUNCTION", new DocComment("/**Description.\n@param {array} pages*"+"/"));
408                 assertEqual(sym.params.length, 1, "user defined param is found.");
409                 assertEqual(sym.params[0].type, "array", "user defined param type is found.");
410                 assertEqual(sym.params[0].name, "pages", "user defined param name is found.");
411                 
412                 sym = new Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new DocComment("/**Description.\n@param {string} uid*"+"/"));
413                 assertEqual(sym.params.length, 1, "user defined param overwrites parser defined param.");
414                 assertEqual(sym.params[0].type, "string", "user defined param type overwrites parser defined param type.");
415                 assertEqual(sym.params[0].name, "uid", "user defined param name overwrites parser defined param name.");
416             
417                 sym = new Symbol("foo", [{type: "array", name: "pages"}, {type: "number", name: "count"}], "FUNCTION", new DocComment("/**Description.\n@param {string} uid*"+"/"));
418                 assertEqual(sym.params.length, 2, "user defined params  overlay parser defined params.");
419                 assertEqual(sym.params[1].type, "number", "user defined param type overlays parser defined param type.");
420                 assertEqual(sym.params[1].name, "count", "user defined param name overlays parser defined param name.");
421
422                 sym = new Symbol("foo", [], "FUNCTION", new DocComment("/**Description.\n@param {array} pages The pages description.*"+"/"));
423                 assertEqual(sym.params.length, 1, "user defined param with description is found.");
424                 assertEqual(sym.params[0].desc, "The pages description.", "user defined param description is found.");
425             */
426             
427             // @constructor
428             if (this.comment.getTag("constructor").length) {
429                 this.isa = "CONSTRUCTOR";
430             }
431             
432             /*~t
433                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@constructor*"+"/"));
434                 assertEqual(sym.isa, "CONSTRUCTOR", "@constructor tag, makes symbol a constructor.");
435             */
436             
437             // @static
438             if (this.comment.getTag("static").length) {
439                 this.isStatic = true;
440                 if (this.isa == "CONSTRUCTOR") {
441                     this.isNamespace = true;
442                 }
443             }
444             
445                 // @static
446             if (this.comment.getTag("singleton").length) {
447                 this.isStatic = true;
448                 //if (this.isa == "CONSTRUCTOR") {
449                 //      this.isNamespace = true;
450                 //}
451             }
452             
453             
454             
455             /*~t
456                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@static\n@constructor*"+"/"));
457                 assertEqual(sym.isStatic, true, "@static tag, makes isStatic true.");
458                 assertEqual(sym.isNamespace, true, "@static and @constructor tag, makes isNamespace true.");
459             */
460             
461             // @inner
462             if (this.comment.getTag("inner").length) {
463                 this.isInner = true;
464                 this.isStatic = false;
465             }
466             
467             /*~t
468                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@inner*"+"/"));
469                 assertEqual(sym.isStatic, false, "@inner tag, makes isStatic false.");
470                 assertEqual(sym.isInner, true, "@inner makes isInner true.");
471             */
472             
473             // @field
474             if (this.comment.getTag("field").length) {
475                 this.isa = "OBJECT";
476             }
477             
478             /*~t
479                 var sym = new Symbol("foo", [], "FUNCTION", new DocComment("/**@field*"+"/"));
480                 assertEqual(sym.isa, "OBJECT", "@field tag, makes symbol an object.");
481             */
482             
483             // @function
484             if (this.comment.getTag("function").length) {
485                 this.isa = "FUNCTION";
486             }
487             
488             // @param
489             if (this.comment.getTag("param").length && this.isa == "OBJECT" ) {
490                 // change a property to a function..
491                 this.isa = "FUNCTION";
492             }
493             
494             
495             /*~t
496                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@function*"+"/"));
497                 assertEqual(sym.isa, "FUNCTION", "@function tag, makes symbol a function.");
498             */
499             
500             // @event
501             var events = this.comment.getTag("event");
502             if (events.length) {
503                 this.isa = "FUNCTION";
504                 this.isEvent = true;
505             }
506             
507             /*~t
508                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@event*"+"/"));
509                 assertEqual(sym.isa, "FUNCTION", "@event tag, makes symbol a function.");
510                 assertEqual(sym.isEvent, true, "@event makes isEvent true.");
511             */
512             
513             // @name
514             var names = this.comment.getTag("name");
515             if (names.length) {
516                 this.setName(names[0].desc);
517             }
518             
519             /*~t
520                 // todo
521             */
522             
523             // @property
524             var properties = this.comment.getTag("property");
525             if (properties.length) {
526                 thisProperties = this.properties;
527                 for (var i = 0; i < properties.length; i++) {
528                     var property = new Symbol(this.alias+"#"+properties[i].name, [], "OBJECT", new DocComment("/**"+properties[i].desc+"\n@name "+properties[i].name+"\n@memberOf "+this.alias+"#*/"));
529                     // TODO: shouldn't the following happen in the addProperty method of Symbol?
530                     property.name = properties[i].name;
531                     property.memberOf = this.alias;
532                     if (properties[i].type) property.type = properties[i].type;
533                     if (properties[i].defaultValue) property.defaultValue = properties[i].defaultValue;
534                     this.addProperty(property);
535                     imports.Parser.Parser.addSymbol(property);
536                 }
537             }
538             
539             // config..
540             var conf = this.comment.getTag("cfg");
541             if (conf.length) {
542                 for (var i = 0; i < conf.length; i++) {
543                     this.addConfig(conf[i]);
544                 }
545             }
546             
547             /*~t
548                 // todo
549             */
550
551             // @return
552             var returns = this.comment.getTag("return");
553             if (returns.length) { // there can be many return tags in a single doclet
554                 this.returns = returns;
555                 this.type = returns.map(function($){return $.type}).join(", ");
556             }
557             
558             /*~t
559                 // todo
560             */
561             
562             // @exception
563             this.exceptions = this.comment.getTag("throws");
564             
565             /*~t
566                 // todo
567             */
568             
569             // @requires
570             var requires = this.comment.getTag("requires");
571             if (requires.length) {
572                 this.requires = requires.map(function($){return $.desc});
573             }
574             
575             /*~t
576                 // todo
577             */
578             
579             // @type
580             var types = this.comment.getTag("type");
581             if (types.length) {
582                 this.type = types[0].desc; //multiple type tags are ignored
583             }
584             
585             /*~t
586                 // todo
587             */
588             
589             // @private
590             if (this.comment.getTag("private").length || this.isInner) {
591                 this.isPrivate = true;
592             }
593             
594             // @ignore
595             if (this.comment.getTag("ignore").length) {
596                 this.isIgnored = true;
597             }
598             
599             /*~t
600                 // todo
601             */
602             
603             // @inherits ... as ...
604             var inherits = this.comment.getTag("inherits");
605             if (inherits.length) {
606                 for (var i = 0; i < inherits.length; i++) {
607                     if (/^\s*([a-z$0-9_.#-]+)(?:\s+as\s+([a-z$0-9_.#]+))?/i.test(inherits[i].desc)) {
608                         var inAlias = RegExp.$1;
609                         var inAs = RegExp.$2 || inAlias;
610
611                         if (inAlias) inAlias = inAlias.replace(/\.prototype\.?/g, "#");
612                         
613                         if (inAs) {
614                             inAs = inAs.replace(/\.prototype\.?/g, "#");
615                             inAs = inAs.replace(/^this\.?/, "#");
616                         }
617
618                         if (inAs.indexOf(inAlias) != 0) { //not a full namepath
619                             var joiner = ".";
620                             if (this.alias.charAt(this.alias.length-1) == "#" || inAs.charAt(0) == "#") {
621                                 joiner = "";
622                             }
623                             inAs = this.alias + joiner + inAs;
624                         }
625                     }
626                     this.inherits.push({alias: inAlias, as: inAs});
627                 }
628             }
629             
630             /*~t
631                 // todo
632             */
633
634             // @augments
635             this.augments = this.comment.getTag("augments");
636             
637             //@extends - Ext
638             if (this.comment.getTag("extends")) {   
639                 this.augments = this.comment.getTag("extends");
640             }
641             
642             
643             // @default
644             var defaults = this.comment.getTag("default");
645             if (defaults.length) {
646                 if (this.is("OBJECT")) {
647                     this.defaultValue = defaults[0].desc;
648                 }
649             }
650             
651             /*~t
652                 // todo
653             */
654             
655             // @memberOf
656             var memberOfs = this.comment.getTag("memberOf");
657             if (memberOfs.length) {
658                 this.memberOf = memberOfs[0].desc;
659                 this.memberOf = this.memberOf.replace(/\.prototype\.?/g, "#");
660             }
661
662             /*~t
663                 // todo
664             */
665             
666             // @public
667             if (this.comment.getTag("public").length) {
668                 this.isPrivate = false;
669             }
670             
671             /*~t
672                 // todo
673             */
674         },
675
676         is : function(what) {
677             return this.isa === what;
678         },
679
680         isBuiltin : function() {
681             return SymbolSet.isBuiltin(this.alias);
682         },
683
684         setType : function(/**String*/comment, /**Boolean*/overwrite) {
685             if (!overwrite && this.type) return;
686             var typeComment = DocComment.unwrapComment(comment);
687             this.type = typeComment;
688         },
689
690         inherit : function(symbol) {
691             if (!this.hasMember(symbol.name) && !symbol.isInner) {
692                 if (symbol.is("FUNCTION"))
693                     this.methods.push(symbol);
694                 else if (symbol.is("OBJECT"))
695                     this.properties.push(symbol);
696             }
697         },
698
699         hasMember : function(name) {
700             return (this.hasMethod(name) || this.hasProperty(name));
701         },
702
703         addMember : function(symbol) {
704             //println("ADDMEMBER: " + this.name +  " ++ " + symbol.name);
705             
706             if (symbol.comment.getTag("cfg").length == 1) { 
707                 symbol.comment.getTag("cfg")[0].memberOf = this.alias;
708                 this.addConfig(symbol.comment.getTag("cfg")[0]);
709                 return;
710             }
711             
712             if (symbol.is("FUNCTION")) { this.addMethod(symbol); }
713             else if (symbol.is("OBJECT")) { this.addProperty(symbol); }
714         },
715
716         hasMethod : function(name) {
717             var thisMethods = this.methods;
718             for (var i = 0, l = thisMethods.length; i < l; i++) {
719                 if (thisMethods[i].name == name) return true;
720                 if (thisMethods[i].alias == name) return true;
721             }
722             return false;
723         },
724
725         addMethod : function(symbol) {
726             var methodAlias = symbol.alias;
727             var thisMethods = this.methods;
728             for (var i = 0, l = thisMethods.length; i < l; i++) {
729                 if (thisMethods[i].alias == methodAlias) {
730                     thisMethods[i] = symbol; // overwriting previous method
731                     return;
732                 }
733             }
734             thisMethods.push(symbol); // new method with this alias
735         },
736
737         hasProperty : function(name) {
738             var thisProperties = this.properties;
739             for (var i = 0, l = thisProperties.length; i < l; i++) {
740                 if (thisProperties[i].name == name) return true;
741                 if (thisProperties[i].alias == name) return true;
742             }
743             return false;
744         },
745
746         addProperty : function(symbol) {
747             var propertyAlias = symbol.alias;
748             var thisProperties = this.properties;
749             for (var i = 0, l = thisProperties.length; i < l; i++) {
750                 if (thisProperties[i].alias == propertyAlias) {
751                     thisProperties[i] = symbol; // overwriting previous property
752                     return;
753                 }
754             }
755
756             thisProperties.push(symbol); // new property with this alias
757         },
758         
759         addDocTag : function(docTag)
760         {
761             this.comment.tags.push(docTag);
762             if (docTag.title == 'cfg') {
763                 this.addConfig(docTag);
764             }
765             
766         },
767         
768         addConfig : function(docTag)
769         {
770             if (typeof(docTag['memberOf']) == 'undefined') {
771                 // remove prototype data...
772                 //var a = this.alias.split('#')[0];
773                 //docTag.memberOf = a;
774                 docTag.memberOf = this.alias;
775             }
776             if (typeof(this.cfgs[docTag.name]) == 'undefined') {
777                 this.cfgs[docTag.name] = docTag;
778             }
779             
780         },
781         configToArray: function()
782         {
783             var r = [];
784             for(var ci in this.cfgs) {
785                 // dont show hidden!!
786                 if (this.cfgs[ci].desc.match(/@hide/)) {
787                     continue;
788                 }
789                 r.push(this.cfgs[ci]); 
790                
791             }
792             return r;
793         }
794 });
795
796 /**
797  * Elements that are not serialized
798  * 
799  */
800 Symbol.hide = [ 
801     '$args' // not needed AFAIK
802 ]
803
804 Symbol.srcFile = ""; //running reference to the current file being parsed
805
806
807 Symbol.fromDump = function(t)
808 {
809     var ns = new Symbol();
810     for (var i in t) {
811         if (typeof(ns[i]) == "undefined") {
812             println("ERR:no default for Symbol:"+ i);
813         }
814         ns[i] = t[i];
815     }
816     return ns;
817 }