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