JSDOC/ScopeParser.js
[gnome.introspection-doc-generator] / JSDOC / ScopeParser.js
index 0778bee..5c6b37a 100644 (file)
@@ -178,7 +178,7 @@ ScopeParser.prototype = {
 
     log : function(str)
     {
-        print ("                    ".substring(0, this.braceNesting) + str);
+        print ("                    ".substring(0, this.braceNesting*2) + str);
         
         //println("<B>LOG:</B>" + htmlescape(str) + "<BR/>\n");
     },
@@ -212,7 +212,7 @@ ScopeParser.prototype = {
         while (token) {
           //  this.timerPrint("parseScope AFTER lookT: " + token.toString()); 
              
-            this.log(token.data);
+            //this.log(token.data);
             if (token.type == 'NAME') {
             //    print('*' + token.data);
             }
@@ -261,9 +261,9 @@ ScopeParser.prototype = {
                         if (token.name == "IN") {
                             break;
                         } else {
-                            var bn = this.braceNesting;
+                            //var bn = this.braceNesting;
                             this.parseExpression();
-                            this.braceNesting = bn;
+                            //this.braceNesting = bn;
                             //this.logR("parseScope DONE  : <B>ParseExpression</B> - tok is:" + this.ts.lookT(0).toString()); 
                             
                             token = this.ts.lookTok(1);
@@ -296,9 +296,14 @@ ScopeParser.prototype = {
                     //print(">>>>>> OBJLIT POP"+ this.braceNesting);
                         //assert braceNesting >= scope.getBra ceNesting();
                     
-                    if (this.braceNesting < 0) {
+                    if (this.braceNesting < expressionBraceNesting) {
                         var ls = this.scopes.pop();
                         ls.getUsedSymbols();
+                        // eat symbol if we are currently at { 
+                        if (this.ts.look(0).data == '{') {
+                            this.ts.nextTok();
+                        }
+                        
                         //print("<<<<<<<EXIT SCOPE" +this.scopes.length);
                         return;
                     }
@@ -497,7 +502,7 @@ ScopeParser.prototype = {
             currentScope = this.scopes[this.scopes.length-1];
             
             //println("<i>"+token.data+"</i>");
-            !this.debug|| print ("EXP" + token.toString());
+            //this.log("EXP:" + token.data);
             switch (token.type) {
                 case 'PUNC':
                     switch(token.data) {
@@ -577,7 +582,8 @@ ScopeParser.prototype = {
                 case 'NAME':
                
                     symbol = token.data;
-                    if (this.ts.lookTok(-1).data == "{"  && this.ts.lookTok(1).data == ":") {
+                  
+                    if (this.ts.look(0).data == "{"  && this.ts.lookTok(2).data == ":") {
                         // then we are in an object lit.. -> we need to flag the brace as such...
                         isObjectLitAr.pop();
                         isObjectLitAr.push(true);
@@ -585,11 +591,11 @@ ScopeParser.prototype = {
                         break;
                     }
                     isInObjectLitAr = isObjectLitAr[isObjectLitAr.length-1];
-                    if (isInObjectLitAr && this.ts.lookTok(-1).data == "," && this.ts.lookTok(1).data == ":") {
+                    if (isInObjectLitAr && this.ts.lookTok(0).data == "," && this.ts.lookTok(2).data == ":") {
                         break;
                     }
-                    
-                    if (this.ts.lookTok(-1).data == ".") {
+                    print(this.ts.lookTok(0).data);
+                    if (this.ts.lookTok(0).data == ".") {
                         //skip '.'
                         break;
                     }