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