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