JSDOC/TokenReader.js
[gnome.introspection-doc-generator] / JSDOC / RooFile.js
index 496a2db..bff3ba4 100644 (file)
@@ -13,6 +13,13 @@ Collapse = imports.Collapse.Collapse;
  *
  *  - Pman.Tab.* appears to work.
  * .. next up ..Dialog...
+ *
+ *
+ *
+ * Current issues:
+ *  - xtype is combined on generated files. (not xns + xtype)
+ *  - listeners are prefixed with '|' ... 
+ *
  * 
  */
 
@@ -58,7 +65,12 @@ RooFile  =  XObject.define(
             
             
             
-            // perfect for dialogs...
+            
+            
+            
+            
+            
+            // perfect for dialogs... - is this our 'generic, non-pman code?'
             
             
             var pos = this.lookFor( 'function');
@@ -249,9 +261,20 @@ RooFile  =  XObject.define(
         parseXObject : function() {
             
             this.parseImports();
-            print(JSON.stringify(this.imports,null,4));
-             print(JSON.stringify(this.giImports,null,4));
-            Seed.quit();
+              
+            var pos = this.lookFor('XObject');
+            if (pos < 0)  {
+                throw "Can not find XObject";
+            }
+            this.cfg.name = this.tokens[pos-3].data;
+            
+            var cfg = this.tokens[pos+1].items[0][0].props;
+            this.cfg.items = [ this.parseProps(cfg) ];
+            
+            //print(JSON.stringify(this.tokens[pos]));
+            
+            //print(JSON.stringify(this.tokens,null,4)); Seed.quit();
+            //Seed.quit();
             
         },
         
@@ -265,8 +288,8 @@ RooFile  =  XObject.define(
         parseImports : function()
         {
            // console.dump(this.tokens);
-            this.giImports = [];
-            this.imports= [];
+            this.cfg.giImports = [];
+            this.cfg.imports= [];
             while (true) {
                 var pos = this.lookFor('=');
                 if (pos < 0)  {
@@ -287,7 +310,7 @@ RooFile  =  XObject.define(
                 }
                 if (v.data.match(/^imports\.gi/)) {
                     // gi import..
-                    this.giImports.push(v.data.replace(/imports\.gi\./, ''));
+                    this.cfg.giImports.push(v.data.replace(/imports\.gi\./, ''));
                     
                     this.cursor++;
                     continue;
@@ -296,7 +319,7 @@ RooFile  =  XObject.define(
                 // two types of import left
                 // imports.xnew
                 if (v.data.match(/^imports\./)) {
-                    this.imports[k.data] = v.data.replace(/imports\./, '') + '.js';
+                    this.cfg.imports[k.data] = v.data.replace(/imports\./, '') + '.js';
                     this.cursor++;
                     continue;
                 }
@@ -308,7 +331,7 @@ RooFile  =  XObject.define(
                 var bpos = this.lookFor('[');
                // console.dump(this.tokens[bpos]);
                 
-                this.imports[k.data] = this.tokens[bpos].items[0][0].toJS();
+                this.cfg.imports[k.data] = this.tokens[bpos].items[0][0].toJS();
                 
                 this.cursor++;
                 
@@ -476,7 +499,9 @@ RooFile  =  XObject.define(
           
         },
         
-        
+        /**
+         * convert a function call token array back into a string
+         */
         expand: function(ar)
         {
             var ret = '';
@@ -490,6 +515,11 @@ RooFile  =  XObject.define(
             
             
         },
+        
+        /***
+         * change the indentation on a function 
+         *
+         */
         clean_body : function(str)
         {
             var lns = str.split("\n");