src/jsdoc/Symbol.vala
[roojspacker] / src / jsdoc / Symbol.vala
index 28929db..cbdd246 100644 (file)
@@ -25,6 +25,7 @@ namespace JSDOC {
                        Symbol.regex_prototype = new GLib.Regex("\\.prototype\\.?");
                }
 
+               private string private_string_name = "";
                private string private_name {
                set {
                                var n = Symbol.regex_global(value, value.length, 0, "");
@@ -36,57 +37,65 @@ namespace JSDOC {
                                        n = n.substring(0, n.length-1);
                                }
                        
-                       this.private_name = n;
+                       this.private_string_name = n;
                }
                
                }
                 
         public string name {
-               get { return this.private_name; }
+               get { return this.private_string_name; }
                }
                
       
         string defaultValue = "";
         
-        
-        private Gee.ArrayList<DocTag> private_params{
-               set  {
-                for (var i = 0; i < value.size; i++) {
-                    //if (v[i].constructor != DocTag) { // may be a generic object parsed from signature, like {type:..., name:...}
-                    //    var ty = v[i].hasOwnProperty('type') ? v[i].type : '';
-                    //    this._params[i] = new DocTag(
-                    //        "param"+((ty)?" {"+ty+"}":"")+" "+v[i].name);
-                    //}
-                    //else {
-                    //    this._params[i] = v[i];
-                    //}
-                    this.private_params.add(v.get(i));
-                }
-                //this.params = this._params;
-            }
-        }
-        public Gee.ArrayList<DocTag> params {
-            get {
-                       return this.private_params;
-               }
-                       
-        }
-        
-        
-        augments : [], // Doctag[]
-        exceptions : [],  // Doctag[]
-        inherits : [],  // Doctag[]
-        methods : [], // Symbol[]
-               //??
-        _params : [], //Doctag[]
-                properties : [], //Doctag[]
-        requires : [],  //Doctag[]
-        returns : [], //Doctag[]
-        see : [], //Doctag[]
-
-        srcFile : {}, //??
-        childClasses : [],
-        cfgs : {},
+               private Gee.ArrayList<DocTag> private_doctag_params;
+
+               private Gee.ArrayList<DocTag> private_params{
+                       set  {
+                               for (var i = 0; i < value.size; i++) {
+                                  
+                                   this.private_doctag_params.add(v.get(i));
+                               }
+                               //this.params = this._params;
+                       }
+               }
+     
+               Gee.ArrayList<string> private_string_params{
+                       set  {
+                               for (var i = 0; i < value.size; i++) {
+
+                                   //var ty = v[i].hasOwnProperty('type') ? v[i].type : '';
+                                   this.private_doctag_params.add( new DocTag(value.get(i)));
+                                          
+                                  //"param"+((ty)?" {"+ty+"}":"")+" "+v.get(i).name);
+                                   
+                               }
+                               
+                       }
+               }
+               public Gee.ArrayList<DocTag> params {
+                       get {
+                               return this.private_doctag_params;
+                       }
+               
+               }
+
+               private Gee.ArrayList<DocTag>  augments ;  
+
+               private Gee.ArrayList<DocTag>  exceptions ;
+
+               private Gee.ArrayList<DocTag>  inherits; 
+               private Gee.ArrayList<DocTag>  methods;
+
+               private Gee.ArrayList<DocTag> properties;
+               private Gee.ArrayList<DocTag> requires;
+               private Gee.ArrayList<DocTag> returns;
+               private Gee.ArrayList<DocTag> see ;
+
+         
+        //childClasses : [],
+        //cfgs : {},
         
         
         DocComment comment;
@@ -114,17 +123,17 @@ namespace JSDOC {
         public bool isPrivate = false;
         public bool isStatic = false;
         
-        string memberOf : "",
+        string memberOf = "";
+
 
-        string _name : "",
 
        
-        string since : "",
+        string since = "";
 
-        string type : "",
-        string version : "",
-        
-        string srcFile = ""
+        string type = "";
+        string version = "";
+       
+        string srcFile = "";
         
         
         
@@ -134,39 +143,39 @@ namespace JSDOC {
 
             
             //this.params = [];
-            this.$args = [];
+            //this.$args = [];
             
             //this.events = [];
-            this.exceptions = [];
-            this.inherits = [];
+            this.exceptions = new Gee.ArrayList<DocTag>();
+            this.inherits = new Gee.ArrayList<DocTag>();
             //
             this.isa = "OBJECT"; // OBJECT//FUNCTION
-            this.methods = [];
-            this._params = [];
-            this.properties = [];
-            this.requires = [];
-            this.returns = [];
-            this.see = [];
+            this.methods = new Gee.ArrayList<DocTag>();
+            //this.private_params = new Gee.ArrayList<DocTag>();
+            this.properties = new Gee.ArrayList<DocTag>();
+            this.requires = new Gee.ArrayList<DocTag>();
+            this.returns = new Gee.ArrayList<DocTag>();
+            this.see = new Gee.ArrayList<DocTag>();
  
             
             
             this.cfgs = {};
             // derived later?
-            this.inheritsFrom = [];
-            this.childClasses = [];
+            //this.inheritsFrom = [];
+            //this.childClasses = [];
             
             this.comment = new DocComment();
             this.comment.isUserComment =  false;
             
                
-        },
+        }
                
                Public Symbol.new_builtin(string name)
                {
             Symbol.regexInit();
             this.initArrays();
             this.srcFile = DocParser.currentSourceFile;
-                       this.setName( name );
+                       this.prviate_name =  name ;
                        this.alias = this.name;
                        this.isa = "CONSTRUCTOR";
                        this.comment = new DocComment("");
@@ -191,13 +200,13 @@ namespace JSDOC {
         ) {
             Symbol.regexInit();
             this.initArrays();
-            this.$args = arguments;
+           // this.$args = arguments;
             //println("Symbol created: " + isa + ":" + name);
-            this.setName(name);
+            this.private_name = name;
             this.alias = this.getName();
-            this.setParams(params);
+            this.private_string_params = params; 
             this.isa = (isa == "VIRTUAL")? "OBJECT":isa;
-            this.comment = comment || new DocComment("")
+            this.comment =  new DocComment(comment);
             
             this.srcFile = DocParser.currentSourceFile;
             
@@ -207,15 +216,20 @@ namespace JSDOC {
                        this.alias = this.srcFile;
                }
 
-            this.setTags();
+            this.tagsFromComment();
             
-        },
+        }
 
-        setTags : function() {
+        void tagsFromComment() {
             // @author
             var authors = this.comment.getTag("author");
-            if (authors.length) {
-                this.author = authors.map(function($){return $.desc;}).join(", ");
+            if (authors.size) {
+                       // turns author into a string....
+                       this.author = "";
+                foreach(var a in authors) {
+                    this.author += (this.author == "") ? "": ", ";
+                    this.author += a.desc;
+                }
             }
             
             /*~t
@@ -236,7 +250,12 @@ namespace JSDOC {
             // @desc
             var descs = this.comment.getTag("desc");
             if (descs.length) {
-                this.desc = descs.map(function($){return $.desc;}).join("\n"); // multiple descriptions are concatenated into one
+                this.desc = "";
+                foreach(var d in desc) {
+                    this.desc = this.desc == "" ? "": "\n";
+                    this.desc += d.desc;
+                }
+
             }
             
             /*~t
@@ -250,7 +269,10 @@ namespace JSDOC {
                 
                 var overviews = this.comment.getTag("overview");
                 if (overviews.length) {
-                    this.desc = [this.desc].concat(overviews.map(function($){return $.desc;})).join("\n");
+                    foreach(var d in overviews) {
+                        this.desc = this.desc == "" ? "": "\n";
+                        this.desc += d.desc;
+                    }
                 }
             }
             
@@ -262,7 +284,11 @@ namespace JSDOC {
             // @since
             var sinces = this.comment.getTag("since");
             if (sinces.length) {
-                this.since = sinces.map(function($){return $.desc;}).join(", ");
+                this.since = "";
+                foreach(var d in sinces) {
+                    this.since = this.since == "" ? "": "\n";
+                    this.since += d.desc;
+                }
             }
             
             /*~t
@@ -273,7 +299,7 @@ namespace JSDOC {
             // @constant
             if (this.comment.getTag("constant").length) {
                 this.isConstant = true;
-                this.isa = 'OBJECT';
+                this.isa = "OBJECT";
             }
             
             /*~t
@@ -284,7 +310,11 @@ namespace JSDOC {
             // @version
             var versions = this.comment.getTag("version");
             if (versions.length) {
-                this.version = versions.map(function($){return $.desc;}).join(", ");
+                this.version = "";
+                 foreach(var d in versions) {
+                    this.version = this.version == "" ? "": "\n";
+                    this.version += d.desc;
+                }
             }
             
             /*~t
@@ -295,7 +325,11 @@ namespace JSDOC {
             // @deprecated
             var deprecateds = this.comment.getTag("deprecated");
             if (deprecateds.length) {
-                this.deprecated = deprecateds.map(function($){return $.desc;}).join("\n");
+                this.deprecated = "";
+                 foreach(var d in deprecateds) {
+                    this.deprecated = this.deprecated == "" ? "": "\n";
+                    this.deprecated += d.desc;
+                }
             }
             
             /*~t