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