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