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