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