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