JsTemplate/Link.js
[gnome.introspection-doc-generator] / JSDOC / ScopeParser.js
index c5b606d..1b315b0 100644 (file)
@@ -98,7 +98,7 @@ ScopeParser.prototype = {
         
     },
     warn: function(s) {
-        print('****************' + s);
+        //print('****************' + s);
         this.warnings.push(s);
         //println("WARNING:" + htmlescape(s) + "<BR>");
     },
@@ -133,7 +133,7 @@ ScopeParser.prototype = {
         this.mode = 'BUILDING_SYMBOL_TREE';
         this.parseScope(this.globalScope);
         
-        print("---------------END PASS 1 ---------------- ");
+        //print("---------------END PASS 1 ---------------- ");
         
     },
     mungeSymboltree : function()
@@ -195,7 +195,7 @@ ScopeParser.prototype = {
     parseScope : function(scope) // parse a token stream..
     {
         //this.timerPrint("parseScope EnterScope"); 
-        print(">>> ENTER SCOPE" + this.scopes.length);
+        //this.log(">>> ENTER SCOPE" + this.scopes.length);
         var symbol;
         var token;
         
@@ -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);
             }
@@ -228,12 +228,15 @@ ScopeParser.prototype = {
                         if (!token) { // can return false at EOF!
                             break;
                         }
-                        if (token.name == "VAR") { // kludge..
+                        if (token.name == "VAR" || token.data == ',') { // kludge..
                             continue;
                         }
                         //this.logR("parseScope GOT VAR  : <B>" + token.toString() + "</B>"); 
                         if (token.type !="NAME") {
-                            print(token.toString());
+                            for(var i = Math.max(this.ts.cursor-10,0); i < this.ts.cursor+1; i++) {
+                                print(this.ts.tokens[i].toString());
+                            }
+                            
                             print( "var without ident");
                             Seed.quit()
                         }
@@ -474,7 +477,7 @@ ScopeParser.prototype = {
             //if (this.ts.nextT()) break;
             
         }
-        print("<<<<<<<EXIT SCOPE ERR?" +this.scopes.length);
+        //print("<<<<<<<EXIT SCOPE ERR?" +this.scopes.length);
     },
 
 
@@ -502,7 +505,7 @@ ScopeParser.prototype = {
             currentScope = this.scopes[this.scopes.length-1];
             
             //println("<i>"+token.data+"</i>");
-            this.log("EXP:" + token.data);
+            //this.log("EXP:" + token.data);
             switch (token.type) {
                 case 'PUNC':
                     switch(token.data) {
@@ -582,7 +585,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);
@@ -590,11 +594,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;
                     }
-                    print(this.ts.lookTok(-1).data);
-                    if (this.ts.lookTok(-1).data == ".") {
+                    //print(this.ts.lookTok(0).data);
+                    if (this.ts.lookTok(0).data == ".") {
                         //skip '.'
                         break;
                     }