JSDOC/RooFile.js
authorAlan Knowles <alan@akbkhome.com>
Tue, 23 Aug 2011 04:33:42 +0000 (12:33 +0800)
committerAlan Knowles <alan@akbkhome.com>
Tue, 23 Aug 2011 04:33:42 +0000 (12:33 +0800)
JSDOC/RooFile.js

index 2e76333..08db4cf 100644 (file)
@@ -242,6 +242,73 @@ RooFile  =  XObject.define(
             
         },
         
+        
+        
+        
+        
+        parseImports : function()
+        {
+           // console.dump(this.tokens);
+            this.giImports = [];
+            while (true) {
+                var pos = this.lookFor('=');
+                if (pos < 0)  {
+                    break;
+                }
+                this.cursor = pos;
+                var k = this.look(-1, true);
+                var v = this.look(1, true);
+               // Seed.print(k.data + " => " + v.data);
+               
+                /// finish!!! - not an import ...
+               
+                if (!v.data.match(/^imports/)) {
+                    return; ///
+                    
+                    this.cursor++;
+                    continue;
+                }
+                if (v.data.match(/^imports\.gi/)) {
+                    // gi import..
+                    this.giImports.push(v.data.replace(/imports\.gi\./, ''));
+                    
+                    this.cursor++;
+                    continue;
+                }
+                  
+                // two types of import left
+                // imports.xnew
+                if (v.data.match(/^imports\./)) {
+                    this.imports[k.data] = v.data.replace(/imports\./, '') + '.js';
+                    this.cursor++;
+                    continue;
+                }
+                // imports[.....]
+                this.cursor++;
+                if (this.lookFor('[') > this.lookFor('=')) {
+                    continue;
+                }
+                var bpos = this.lookFor('[');
+               // console.dump(this.tokens[bpos]);
+                
+                this.imports[k.data] = this.tokens[bpos].items[0][0].toJS();
+                
+                this.cursor++;
+                
+            }
+        //    console.dump(this.giImports);
+          //  console.dump(this.imports);
+            //Seed.quit();
+            
+        },
+        
+        ///------------------- GENERIC PARSING ------------------
+        
+        
+        
+        
+        
+        
         parseProps:  function(o)
         {
             //print(JSON.stringify(o,null,4));