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