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