JSDOC/TokenReader.js
[gnome.introspection-doc-generator] / JSDOC / ScopeParser.js
index ed51371..7c77be0 100644 (file)
@@ -1,7 +1,7 @@
 //<Script type="text/javascript">
 
-Scope = imports.Scope.Scope;
-TokenStream = imports.TokenStream.TokenStream;
+const Scope = imports.Scope.Scope;
+const TokenStream = imports.TokenStream.TokenStream;
 /**
 * Scope stuff
 * 
@@ -11,7 +11,7 @@ TokenStream = imports.TokenStream.TokenStream;
 * 
 */
 
-ScopeParser = function(ts) {
+const ScopeParser = function(ts) {
     this.ts = ts; // {TokenStream}
     this.warnings = [];
     this.indexedg = {};
@@ -176,6 +176,8 @@ ScopeParser.prototype = {
         
         
         this.globalScope.munge();
+        this.globalScope.dump();
+        
     },
 
 
@@ -226,9 +228,9 @@ ScopeParser.prototype = {
             //this.dumpToken(token , this.scopes, this.braceNesting);
             //print('SCOPE:' + token.toString());
             //this.log(token.data);
-            if (token.type == 'NAME') {
+            //if (token.type == 'NAME') {
             //    print('*' + token.data);
-            }
+            //}
             switch(token.type + '.' + token.name) {
                 case "KEYW.VAR":
                 case "KEYW.CONST": // not really relivant as it's only mozzy that does this.
@@ -332,6 +334,8 @@ ScopeParser.prototype = {
                     var curTS = this.ts;
                     if (token.props) {
                         
+                        // { a : ... , c : .... }
+                        
                         for (var prop in token.props) {
                             
                             
@@ -357,10 +361,13 @@ ScopeParser.prototype = {
                         break;
                     }
                     
+                    // ( ... ) or { .... } not object literals..
                     
                     var _this = this;
-                    token.items.forEach(function(expr) {
-                           //print(JSON.stringify(expr, null,4));
+                   for (var xx =0; xx < token.items.length; xx++) {
+                               expr = token.items[xx];
+                    //token.items.forEach(function(expr) {
+                            //print(expr.toString());
                            _this.ts = new TokenStream(expr);
                             //if (curTS.data == '(') {
                                 _this.parseScope(scope)
@@ -368,7 +375,7 @@ ScopeParser.prototype = {
                               //  _this.parseExpression(scope)
                             //}
                           
-                    });
+                    }  
                     this.ts = curTS;
                     //print("NOT PROPS"); Seed.quit();
                     
@@ -493,7 +500,7 @@ ScopeParser.prototype = {
 
                         if (token.name == "EVAL") {
                             
-                            print(JSON.stringify(token, null,4));
+                            //print(JSON.stringify(token, null,4));
                             // look back one and see if we can find a comment!!!
                             //if (this.ts.look(-1).type == "COMM") {
                             if (token.prefix && token.prefix.match(/eval/)) {
@@ -567,7 +574,7 @@ ScopeParser.prototype = {
             
         
         //print(scopeIndent + ">> ENTER EXPRESSION" + this.expN);
-        while (token = this.ts.nextTok()) {
+        while ((token = this.ts.nextTok())) {
      
         
             
@@ -749,7 +756,7 @@ ScopeParser.prototype = {
                     if (this.mode == 'BUILDING_SYMBOL_TREE') {
                         
                         if (token.name == "EVAL") {
-                            print(JSON.stringify(token,null,4));
+                            //print(JSON.stringify(token,null,4));
                             if (token.prefix && token.prefix.match(/eval:var:/g)) {
                                 // look for eval:var:noreplace\n
                                // print("GOT MATCH?");
@@ -794,7 +801,7 @@ ScopeParser.prototype = {
 
         var symbol;
         var token;
-        var scope;
+         
         var identifier;
         
         //token = getToken(-1);
@@ -822,7 +829,7 @@ ScopeParser.prototype = {
             identifier.refcount++;
         }
         
-        token = this.ts.nextTok();
+        //token = this.ts.nextTok();
         //assert token.getType() == Token.RP; // )
     },
     
@@ -857,9 +864,7 @@ ScopeParser.prototype = {
         while (token.data != "(") {
             //print(token.toString());
             token =  this.ts.nextTok();
-            
-            
-            
+             
         }
         
         
@@ -955,4 +960,4 @@ ScopeParser.prototype = {
         }
         return false;
     }
-};
\ No newline at end of file
+};