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