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