JSDOC/TokenReader.js
[gnome.introspection-doc-generator] / JSDOC / RooFile.js
index d88081f..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');
@@ -189,6 +201,7 @@ RooFile  =  XObject.define(
                 
         },
         
+        
         parsePmanLayout : function()
         {
                 // then it's a layout style..
@@ -244,6 +257,27 @@ RooFile  =  XObject.define(
             
         },
         
+        // Seed xobject file.
+        parseXObject : function() {
+            
+            this.parseImports();
+              
+            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();
+            
+        },
+        
         
         
         /**
@@ -254,7 +288,8 @@ RooFile  =  XObject.define(
         parseImports : function()
         {
            // console.dump(this.tokens);
-            this.giImports = [];
+            this.cfg.giImports = [];
+            this.cfg.imports= [];
             while (true) {
                 var pos = this.lookFor('=');
                 if (pos < 0)  {
@@ -275,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;
@@ -284,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;
                 }
@@ -296,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++;
                 
@@ -464,7 +499,9 @@ RooFile  =  XObject.define(
           
         },
         
-        
+        /**
+         * convert a function call token array back into a string
+         */
         expand: function(ar)
         {
             var ret = '';
@@ -478,6 +515,11 @@ RooFile  =  XObject.define(
             
             
         },
+        
+        /***
+         * change the indentation on a function 
+         *
+         */
         clean_body : function(str)
         {
             var lns = str.split("\n");