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