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