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