JSDOC/Walker2.js
[gnome.introspection-doc-generator] / JSDOC / Walker2.js
index db484bf..7b4ca3f 100644 (file)
@@ -71,6 +71,7 @@ Walker2 = XObject.define(
             
             this.mode = 'BUILDING_SYMBOL_TREE';
             this.parseScope(this.globalScope);
+            
         },
         
 
@@ -158,10 +159,11 @@ Walker2 = XObject.define(
                 //print("TOK"+ token.toString());
                 //  this.timerPrint("parseScope AFTER lookT: " + token.toString()); 
                   
-                if (token.is('WHIT')) {
+                if (token.is('COMM')) {
                       
                  
-                    if (!token._isDoc) {
+                    if (token.name != 'JSDOC') {
+                        //print("Walker2 : spce is not JSDOC");
                         continue; //skip.
                     }
                     if (this.currentDoc) {
@@ -169,7 +171,6 @@ Walker2 = XObject.define(
                         
                         this.addSymbol('', true);
 
-                        
                         //throw "Unconsumed Doc (TOKwhitespace): " + this.currentDoc.toSource();
                     }
                     
@@ -178,7 +179,7 @@ Walker2 = XObject.define(
                     
                     // it's a scope changer..
                     if (newDoc.getTag("scope").length) {
-                        //print(newDoc.getTag("scope").toSource());
+                        //print("Walker2 : doctag changes scope");
                         //throw "done";
                         scope.ident = '$private$|' + newDoc.getTag("scope")[0].desc;
                         continue;
@@ -188,6 +189,7 @@ Walker2 = XObject.define(
                     if (newDoc.getTag("scopeAlias").length) {
                         //print(newDoc.getTag("scopeAlias").toSource());
                         // @scopeAlias a=b
+                        //print("Walker2 : doctag changes scope (alias)");
                         var sal = newDoc.getTag("scopeAlias")[0].desc.split("=");
                         aliases[sal[0]] = sal[1];
                         
@@ -197,6 +199,7 @@ Walker2 = XObject.define(
                     
                     /// got a  doc comment..
                     //token.data might be this.??? (not sure though)
+                    //print("Walker2 : setting currentDoc");
                     this.currentDoc = newDoc;
                     continue;
                 }
@@ -330,7 +333,16 @@ Walker2 = XObject.define(
                     
                     
                      // apply ( XXXX,  {
-                         
+                    /*
+                    print(JSON.stringify([
+                        token.data,
+                        this.ts.lookTok(1).data ,
+                        this.ts.lookTok(2).type ,
+                        this.ts.lookTok(3).data ,
+                        this.ts.lookTok(4).data 
+                    ], null, 4));
+                    */
+                    
                     if (/\.(applyIf|apply)$/.test(token.data) && 
                         this.ts.lookTok(1).data == '('  &&
                         this.ts.lookTok(2).type == 'NAME' &&
@@ -348,14 +360,13 @@ Walker2 = XObject.define(
                                       
                         if (this.currentDoc) {
                             this.addSymbol(scopeName,false,'OBJECT');
-
                         }
                      
 
                         
                         this.ts.nextTok(); /// ,
                         this.ts.nextTok(); // {
-                            scopeName = fixAlias(scopeName);
+                        scopeName = fixAlias(scopeName);
                         var fnScope = new Scope(this.braceNesting, scope, token.n, scopeName);
                         this.indexedScopes[this.ts.cursor] = fnScope;
                         scope = fnScope;
@@ -370,7 +381,15 @@ Walker2 = XObject.define(
                     // xxx = new yyy ( {
                         
                     // change scope to xxxx
-                    
+                    /*
+                    print(JSON.stringify([
+                        this.ts.lookTok(1).data ,
+                        this.ts.lookTok(2).name ,
+                        this.ts.lookTok(3).type ,
+                        this.ts.lookTok(4).data ,
+                        this.ts.lookTok(5).data 
+                    ], null, 4));
+                    */
                     if ( this.ts.lookTok(1).data == '=' &&
                         this.ts.lookTok(2).name == 'NEW' &&
                         this.ts.lookTok(3).type == 'NAME' &&
@@ -493,6 +512,7 @@ Walker2 = XObject.define(
                         scopeName = fixAlias(scopeName);
                         var fnScope = new Scope(this.braceNesting, scope, token.n, 
                             '$this$='+scopeName+'.prototype|$private$|'+scopeName+'.prototype');
+                            
                         this.indexedScopes[this.ts.cursor] = fnScope;
                         //scope = fnScope;
                         //this.scopesIn(fnScope);
@@ -720,7 +740,7 @@ Walker2 = XObject.define(
          
         addSymbol: function(lastIdent, appendIt, atype )
         {
-            
+            print("addSymbol : " + lastIndent);
             /*if (!this.currentDoc.tags.length) {