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