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