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