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