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 : [],
30         author : "",
31         classDesc : "",
32         comment : { isUserComment: false },
33         deprecated : "",
34         desc : "",
35         events : [],
36         example : "",
37         exceptions : [],
38         inherits : [],
39         inheritsFrom : [],
40         isa : "OBJECT", // OBJECT//FUNCTION
41         isEvent : false,
42         isConstant : false,
43         isIgnored : false,
44         isInner : false,
45         isNamespace : false,
46         isPrivate : false,
47         isStatic : false,
48         memberOf : "",
49         methods : [],
50         _name : "",
51         _params : [],
52         properties : [],
53         requires : [],
54         returns : [],
55         see : [],
56         since : "",
57         srcFile : {},
58         type : "",
59         version : "",
60         childClasses : [],
61         cfgs : {},
62         
63         
64             
65         
66         toObject : function()
67         {
68             
69             function array2object(a , m)
70             {
71                 m = m || false;
72                 var r = [];
73                 a.forEach(function(e) {
74                     r.push(m ? e : e.toObject());
75                 })
76             }
77             
78             var ret = { };
79             for (var i in this) {
80                 if (Symbol.hide.indexOf(i) > -1) {
81                     continue;
82                 }
83                 switch (typeof(this[i])) {
84                     case 'function':
85                         continue;
86                     case 'object':
87                         switch(i) {
88                             //arrays..
89                             case 'params' : 
90                                 ret[i] = array2object(this[i],true); 
91                                 continue;
92                             //objects..
93                             case 'augments' : 
94                                 ret[i] = this[i].toArray();
95                                 continue;
96                             default:
97                                 print("object? :" + i);
98                                 Seed.quit();
99                         }
100                         
101                         
102                     case 'string':
103                     case 'number':
104                         ret[i] = this[i]; continue;
105                     default:
106                         print("unknown type:" + typeof(this[i]));
107                         Seed.quit();
108                    }
109             }
110             
111             
112         },
113         
114         init : function() 
115         {
116             this.name = "";
117             this.defaultValue = "";
118             this.params = [];
119             this.$args = [];
120             this.addOn = "";
121             this.alias = "";
122             this.augments = [];
123             this.author = "";
124             this.classDesc = "";
125             this.comment = { isUserComment: false };
126             //this.defaultValue = null;
127             this.deprecated = "";
128             this.desc = "";
129             this.events = [];
130             this.example = "";
131             this.exceptions = [];
132             this.inherits = [];
133             this.inheritsFrom = [];
134             this.isa = "OBJECT"; // OBJECT//FUNCTION
135             this.isEvent = false;
136             this.isConstant = false;
137             this.isIgnored = false;
138             this.isInner = false;
139             this.isNamespace = false;
140             this.isPrivate = false;
141             this.isStatic = false;
142             this.memberOf = "";
143             this.methods = [];
144             this._name = "";
145             this._params = [];
146             this.properties = [];
147             this.requires = [];
148             this.returns = [];
149             this.see = [];
150             this.since = "";
151             this.srcFile = {};
152             this.type = "";
153             this.version = "";
154             this.childClasses = [];
155             this.cfgs = {};
156                
157         },
158
159         serialize : function() {
160             var keys = [];
161             for (var p in this) {
162                 keys.push (p);
163             }
164             keys = keys.sort();
165             
166             var out = "";
167             for (var i in keys) {
168                 if (typeof this[keys[i]] == "function") continue;
169                 out += "     " +keys[i]+" => "+
170                     (   
171                         (typeof(this[keys[i]]) != "object") ?  
172                             this[keys[i]] :
173                             "[" +typeof(this[keys[i]])+"]"
174                     ) + 
175                     ",\n";
176             }
177             return "\n{\n" + out + "}\n";
178         },
179
180         clone : function() {
181             var clone = new Symbol();
182             clone.populate.apply(clone, this.$args); // repopulate using the original arguments
183             clone.srcFile = this.srcFile; // not the current srcFile, the one when the original was made
184             return clone;
185         },
186
187
188
189
190         //__defineSetter__("name",
191         setName  : function(n) { 
192                 n = n.replace(/^_global_[.#-]/, ""); 
193                 n = n.replace(/\.prototype\.?/g, '#'); 
194                  n = n.replace(/#$/g, ''); 
195                 this._name = n;
196                 this.name = n; // real!
197             },
198         //);
199         //__defineGetter__("name",
200         getName : function() { return this._name; },
201         //);
202         //__defineSetter__("params", 
203         setParams  :function(v) {
204                 for (var i = 0, l = v.length; i < l; i++) {
205                     if (v[i].constructor != DocTag) { // may be a generic object parsed from signature, like {type:..., name:...}
206                         var ty = v[i].hasOwnProperty('type') ? v[i].type : '';
207                         this._params[i] = new DocTag(
208                             "param"+((ty)?" {"+ty+"}":"")+" "+v[i].name);
209                     }
210                     else {
211                         this._params[i] = v[i];
212                     }
213                 }
214                 this.params = this._params;
215             },
216         //);
217
218
219         //__defineGetter__("params",
220         getParams : function() { return this._params; },
221         //);
222
223         populate : function(
224                 /** String */ name,
225                 /** Object[] */ params,
226                 /** String */ isa,
227                 /** DocComment */ comment
228         ) {
229             this.$args = arguments;
230             //println("Symbol created: " + isa + ":" + name);
231             this.setName(name);
232             this.alias = this.getName();
233             this.setParams(params);
234             this.isa = (isa == "VIRTUAL")? "OBJECT":isa;
235             this.comment = comment || new DocComment("");
236             this.srcFile = Symbol.srcFile;
237             
238            
239             
240             if (this.is("FILE") && !this.alias) this.alias = this.srcFile;
241
242             this.setTags();
243             
244             //if (typeof PluginManager != "undefined") {
245             //    PluginManager.run("onSymbol", this);
246             //}
247         },
248
249         setTags : function() {
250             // @author
251             var authors = this.comment.getTag("author");
252             if (authors.length) {
253                 this.author = authors.map(function($){return $.desc;}).join(", ");
254             }
255             
256             /*~t
257                 assert("testing Symbol");
258                 
259                 requires("../lib/JSDOC/DocComment.js");
260                 requires("../frame/String.js");
261                 requires("../lib/JSDOC/DocTag.js");
262
263                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@author Joe Smith*"+"/"));
264                 assertEqual(sym.author, "Joe Smith", "@author tag, author is found.");
265             */
266             // @desc
267             var mth = this.comment.getTag("method");
268             if (mth.length) {
269                 this.isa = "FUNCTION";
270             }
271             // @desc
272             var descs = this.comment.getTag("desc");
273             if (descs.length) {
274                 this.desc = descs.map(function($){return $.desc;}).join("\n"); // multiple descriptions are concatenated into one
275             }
276             
277             /*~t
278                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@desc This is a description.*"+"/"));
279                 assertEqual(sym.desc, "This is a description.", "@desc tag, description is found.");
280             */
281             
282             // @overview
283             if (this.is("FILE")) {
284                 if (!this.alias) this.alias = this.srcFile;
285                 
286                 var overviews = this.comment.getTag("overview");
287                 if (overviews.length) {
288                     this.desc = [this.desc].concat(overviews.map(function($){return $.desc;})).join("\n");
289                 }
290             }
291             
292             /*~t
293                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@overview This is an overview.*"+"/"));
294                 assertEqual(sym.desc, "\nThis is an overview.", "@overview tag, description is found.");
295             */
296             
297             // @since
298             var sinces = this.comment.getTag("since");
299             if (sinces.length) {
300                 this.since = sinces.map(function($){return $.desc;}).join(", ");
301             }
302             
303             /*~t
304                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@since 1.01*"+"/"));
305                 assertEqual(sym.since, "1.01", "@since tag, description is found.");
306             */
307             
308             // @constant
309             if (this.comment.getTag("constant").length) {
310                 this.isConstant = true;
311                 this.isa = 'OBJECT';
312             }
313             
314             /*~t
315                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@constant*"+"/"));
316                 assertEqual(sym.isConstant, true, "@constant tag, isConstant set.");
317             */
318             
319             // @version
320             var versions = this.comment.getTag("version");
321             if (versions.length) {
322                 this.version = versions.map(function($){return $.desc;}).join(", ");
323             }
324             
325             /*~t
326                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@version 2.0x*"+"/"));
327                 assertEqual(sym.version, "2.0x", "@version tag, version is found.");
328             */
329             
330             // @deprecated
331             var deprecateds = this.comment.getTag("deprecated");
332             if (deprecateds.length) {
333                 this.deprecated = deprecateds.map(function($){return $.desc;}).join("\n");
334             }
335             
336             /*~t
337                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@deprecated Use other method.*"+"/"));
338                 assertEqual(sym.deprecated, "Use other method.", "@deprecated tag, desc is found.");
339             */
340             
341             // @example
342             var examples = this.comment.getTag("example");
343             if (examples.length) {
344                 this.example = examples[0];
345             }
346             
347             /*~t
348                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@example This\n  is an example.*"+"/"));
349                 assertEqual(sym.example, "This\n  is an example.", "@deprecated tag, desc is found.");
350             */
351             
352             // @see
353             var sees = this.comment.getTag("see");
354             if (sees.length) {
355                 var thisSee = this.see;
356                 sees.map(function($){thisSee.push($.desc);});
357             }
358             
359             /*~t
360                 var sym = new Symbol("foo", [], "FILE", new DocComment("/**@see The other thing.*"+"/"));
361                 assertEqual(sym.see, "The other thing.", "@see tag, desc is found.");
362             */
363             
364             // @class
365             var classes = this.comment.getTag("class");
366             if (classes.length) {
367                 this.isa = "CONSTRUCTOR";
368                 this.classDesc = classes[0].desc; // desc can't apply to the constructor as there is none.
369                 if (!this.classDesc) {
370                     this.classDesc = this.desc;
371                    }
372                 
373                 
374             }
375             
376             /*~t
377                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@class This describes the class.*"+"/"));
378                 assertEqual(sym.isa, "CONSTRUCTOR", "@class tag, makes symbol a constructor.");
379                 assertEqual(sym.classDesc, "This describes the class.", "@class tag, class description is found.");
380             */
381             
382             // @namespace
383             var namespaces = this.comment.getTag("namespace");
384             if (namespaces.length) {
385                 this.classDesc = namespaces[0].desc+"\n"+this.desc; // desc can't apply to the constructor as there is none.
386                 this.isNamespace = true;
387             }
388             
389             /*~t
390                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@namespace This describes the namespace.*"+"/"));
391                 assertEqual(sym.classDesc, "This describes the namespace.\n", "@namespace tag, class description is found.");
392             */
393             
394             // @param
395             var params = this.comment.getTag("param");
396             if (params.length) {
397                 // user-defined params overwrite those with same name defined by the parser
398                 var thisParams = this.getParams();
399
400                 if (thisParams.length == 0) { // none exist yet, so just bung all these user-defined params straight in
401                     this.setParams(params);
402                 }
403                 else { // need to overlay these user-defined params on to existing parser-defined params
404                     for (var i = 0, l = params.length; i < l; i++) {
405                         if (thisParams[i]) {
406                             if (params[i].type) thisParams[i].type = params[i].type;
407                             thisParams[i].name = params[i].name;
408                             thisParams[i].desc = params[i].desc;
409                             thisParams[i].isOptional = params[i].isOptional;
410                             thisParams[i].defaultValue = params[i].defaultValue;
411                         }
412                         else thisParams[i] = params[i];
413                     }
414                 }
415             }
416             
417             /*~t
418                 var sym = new Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new DocComment("/**Description.*"+"/"));
419                 assertEqual(sym.params.length, 1, "parser defined param is found.");
420                 
421                 sym = new Symbol("foo", [], "FUNCTION", new DocComment("/**Description.\n@param {array} pages*"+"/"));
422                 assertEqual(sym.params.length, 1, "user defined param is found.");
423                 assertEqual(sym.params[0].type, "array", "user defined param type is found.");
424                 assertEqual(sym.params[0].name, "pages", "user defined param name is found.");
425                 
426                 sym = new Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new DocComment("/**Description.\n@param {string} uid*"+"/"));
427                 assertEqual(sym.params.length, 1, "user defined param overwrites parser defined param.");
428                 assertEqual(sym.params[0].type, "string", "user defined param type overwrites parser defined param type.");
429                 assertEqual(sym.params[0].name, "uid", "user defined param name overwrites parser defined param name.");
430             
431                 sym = new Symbol("foo", [{type: "array", name: "pages"}, {type: "number", name: "count"}], "FUNCTION", new DocComment("/**Description.\n@param {string} uid*"+"/"));
432                 assertEqual(sym.params.length, 2, "user defined params  overlay parser defined params.");
433                 assertEqual(sym.params[1].type, "number", "user defined param type overlays parser defined param type.");
434                 assertEqual(sym.params[1].name, "count", "user defined param name overlays parser defined param name.");
435
436                 sym = new Symbol("foo", [], "FUNCTION", new DocComment("/**Description.\n@param {array} pages The pages description.*"+"/"));
437                 assertEqual(sym.params.length, 1, "user defined param with description is found.");
438                 assertEqual(sym.params[0].desc, "The pages description.", "user defined param description is found.");
439             */
440             
441             // @constructor
442             if (this.comment.getTag("constructor").length) {
443                 this.isa = "CONSTRUCTOR";
444             }
445             
446             /*~t
447                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@constructor*"+"/"));
448                 assertEqual(sym.isa, "CONSTRUCTOR", "@constructor tag, makes symbol a constructor.");
449             */
450             
451             // @static
452             if (this.comment.getTag("static").length) {
453                 this.isStatic = true;
454                 if (this.isa == "CONSTRUCTOR") {
455                     this.isNamespace = true;
456                 }
457             }
458             
459                 // @static
460             if (this.comment.getTag("singleton").length) {
461                 this.isStatic = true;
462                 //if (this.isa == "CONSTRUCTOR") {
463                 //      this.isNamespace = true;
464                 //}
465             }
466             
467             
468             
469             /*~t
470                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@static\n@constructor*"+"/"));
471                 assertEqual(sym.isStatic, true, "@static tag, makes isStatic true.");
472                 assertEqual(sym.isNamespace, true, "@static and @constructor tag, makes isNamespace true.");
473             */
474             
475             // @inner
476             if (this.comment.getTag("inner").length) {
477                 this.isInner = true;
478                 this.isStatic = false;
479             }
480             
481             /*~t
482                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@inner*"+"/"));
483                 assertEqual(sym.isStatic, false, "@inner tag, makes isStatic false.");
484                 assertEqual(sym.isInner, true, "@inner makes isInner true.");
485             */
486             
487             // @field
488             if (this.comment.getTag("field").length) {
489                 this.isa = "OBJECT";
490             }
491             
492             /*~t
493                 var sym = new Symbol("foo", [], "FUNCTION", new DocComment("/**@field*"+"/"));
494                 assertEqual(sym.isa, "OBJECT", "@field tag, makes symbol an object.");
495             */
496             
497             // @function
498             if (this.comment.getTag("function").length) {
499                 this.isa = "FUNCTION";
500             }
501             
502             // @param
503             if (this.comment.getTag("param").length && this.isa == "OBJECT" ) {
504                 // change a property to a function..
505                 this.isa = "FUNCTION";
506             }
507             
508             
509             /*~t
510                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@function*"+"/"));
511                 assertEqual(sym.isa, "FUNCTION", "@function tag, makes symbol a function.");
512             */
513             
514             // @event
515             var events = this.comment.getTag("event");
516             if (events.length) {
517                 this.isa = "FUNCTION";
518                 this.isEvent = true;
519             }
520             
521             /*~t
522                 var sym = new Symbol("foo", [], "OBJECT", new DocComment("/**@event*"+"/"));
523                 assertEqual(sym.isa, "FUNCTION", "@event tag, makes symbol a function.");
524                 assertEqual(sym.isEvent, true, "@event makes isEvent true.");
525             */
526             
527             // @name
528             var names = this.comment.getTag("name");
529             if (names.length) {
530                 this.setName(names[0].desc);
531             }
532             
533             /*~t
534                 // todo
535             */
536             
537             // @property
538             var properties = this.comment.getTag("property");
539             if (properties.length) {
540                 thisProperties = this.properties;
541                 for (var i = 0; i < properties.length; i++) {
542                     var property = new Symbol(this.alias+"#"+properties[i].name, [], "OBJECT", new DocComment("/**"+properties[i].desc+"\n@name "+properties[i].name+"\n@memberOf "+this.alias+"#*/"));
543                     // TODO: shouldn't the following happen in the addProperty method of Symbol?
544                     property.name = properties[i].name;
545                     property.memberOf = this.alias;
546                     if (properties[i].type) property.type = properties[i].type;
547                     if (properties[i].defaultValue) property.defaultValue = properties[i].defaultValue;
548                     this.addProperty(property);
549                     imports.Parser.Parser.addSymbol(property);
550                 }
551             }
552             
553             // config..
554             var conf = this.comment.getTag("cfg");
555             if (conf.length) {
556                 for (var i = 0; i < conf.length; i++) {
557                     this.addConfig(conf[i]);
558                 }
559             }
560             
561             /*~t
562                 // todo
563             */
564
565             // @return
566             var returns = this.comment.getTag("return");
567             if (returns.length) { // there can be many return tags in a single doclet
568                 this.returns = returns;
569                 this.type = returns.map(function($){return $.type}).join(", ");
570             }
571             
572             /*~t
573                 // todo
574             */
575             
576             // @exception
577             this.exceptions = this.comment.getTag("throws");
578             
579             /*~t
580                 // todo
581             */
582             
583             // @requires
584             var requires = this.comment.getTag("requires");
585             if (requires.length) {
586                 this.requires = requires.map(function($){return $.desc});
587             }
588             
589             /*~t
590                 // todo
591             */
592             
593             // @type
594             var types = this.comment.getTag("type");
595             if (types.length) {
596                 this.type = types[0].desc; //multiple type tags are ignored
597             }
598             
599             /*~t
600                 // todo
601             */
602             
603             // @private
604             if (this.comment.getTag("private").length || this.isInner) {
605                 this.isPrivate = true;
606             }
607             
608             // @ignore
609             if (this.comment.getTag("ignore").length) {
610                 this.isIgnored = true;
611             }
612             
613             /*~t
614                 // todo
615             */
616             
617             // @inherits ... as ...
618             var inherits = this.comment.getTag("inherits");
619             if (inherits.length) {
620                 for (var i = 0; i < inherits.length; i++) {
621                     if (/^\s*([a-z$0-9_.#-]+)(?:\s+as\s+([a-z$0-9_.#]+))?/i.test(inherits[i].desc)) {
622                         var inAlias = RegExp.$1;
623                         var inAs = RegExp.$2 || inAlias;
624
625                         if (inAlias) inAlias = inAlias.replace(/\.prototype\.?/g, "#");
626                         
627                         if (inAs) {
628                             inAs = inAs.replace(/\.prototype\.?/g, "#");
629                             inAs = inAs.replace(/^this\.?/, "#");
630                         }
631
632                         if (inAs.indexOf(inAlias) != 0) { //not a full namepath
633                             var joiner = ".";
634                             if (this.alias.charAt(this.alias.length-1) == "#" || inAs.charAt(0) == "#") {
635                                 joiner = "";
636                             }
637                             inAs = this.alias + joiner + inAs;
638                         }
639                     }
640                     this.inherits.push({alias: inAlias, as: inAs});
641                 }
642             }
643             
644             /*~t
645                 // todo
646             */
647
648             // @augments
649             this.augments = this.comment.getTag("augments");
650             
651             //@extends - Ext
652             if (this.comment.getTag("extends")) {   
653                 this.augments = this.comment.getTag("extends");
654             }
655             
656             
657             // @default
658             var defaults = this.comment.getTag("default");
659             if (defaults.length) {
660                 if (this.is("OBJECT")) {
661                     this.defaultValue = defaults[0].desc;
662                 }
663             }
664             
665             /*~t
666                 // todo
667             */
668             
669             // @memberOf
670             var memberOfs = this.comment.getTag("memberOf");
671             if (memberOfs.length) {
672                 this.memberOf = memberOfs[0].desc;
673                 this.memberOf = this.memberOf.replace(/\.prototype\.?/g, "#");
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 }