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