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