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