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