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