JSDOC/ScopeParser.js
[gnome.introspection-doc-generator] / JSDOC / ScopeParser.js
index b9a7d1f..1f3a5d6 100644 (file)
@@ -1,7 +1,7 @@
 //<Script type="text/javascript">
 
-Scope = imports['JSDOC/Scope.js'].Scope;
-
+Scope = imports.Scope.Scope;
+TokenStream = imports.TokenStream.TokenStream;
 /**
 * Scope stuff
 * 
@@ -313,7 +313,7 @@ ScopeParser.prototype = {
                     
                     break;
                 case "KEYW.FUNCTION":
-                    print('SCOPE-FUNC:' + token.toString());
+                    print('SCOPE-FUNC:' + JSON.stringify(token,null,4));
                     //println("<i>"+token.data+"</i>");
                      var bn = this.braceNesting;
                     this.parseFunctionDeclaration();
@@ -321,7 +321,7 @@ ScopeParser.prototype = {
                     break;
 
                 case "PUNC.LEFT_CURLY": // {
-                    print('SCOPE-CURLY:' + JSON.stringify(token,null,4));
+                    
                     //println("<i>"+token.data+"</i>");
                     
                     if (token.props) {
@@ -337,7 +337,6 @@ ScopeParser.prototype = {
                             this.ts = new TokenStream(token.props[prop].val);
                             this.parseScope(scope);
                             
-                            
                         }
                         this.ts = curTS;
                         
@@ -345,6 +344,8 @@ ScopeParser.prototype = {
                         // the values could be replaced..
                         
                     }
+                    print('SCOPE-CURLY:' + JSON.stringify(token,null,4));
+                    print("NOT PROPS"); Seed.quit();
                     
                     isObjectLitAr.push(false);
                     this.braceNesting++;
@@ -851,10 +852,12 @@ ScopeParser.prototype = {
           
         }
         
+        print('FUNC-PARSE:' + JSON.stringify(token,null,4));
         // Parse function arguments.
-        var argpos = 0;
-        while (this.ts.lookTok().data != ')') { //(token = consumeToken()).getType() != Token.RP) {
-            token = this.ts.nextTok();
+        var args = token.items;
+        for (var argpos =0; argpos < args.length; argpos++) {
+             
+            token = args[argpos][0];
            // print ("FUNC ARGS: " + token.toString())
             //assert token.getType() == Token.NAME ||
             //        token.getType() == Token.COMMA;
@@ -868,20 +871,24 @@ ScopeParser.prototype = {
                 argpos++;
             }
         }
-
+        
         token = this.ts.nextTok();
+       // print('FUNC-BODY:' + JSON.stringify(token,null,4));
+        //Seed.quit();
         //print(token.toString());
         // assert token.getType() == Token.LC;
-        this.braceNesting++;
-
-        token = this.ts.nextTok();
+        //this.braceNesting++;
+        
+        //token = this.ts.nextTok();
         //print(token.toString());
-     
-
+        var outTS = this.ts;
+        this.ts = new TokenStream(token.items);
+        print(JSON.stringify(this.ts,null,4);
         this.parseScope(fnScope);
+        this.ts = outTS;
         // now pop it off the stack!!!
        
-        this.braceNesting = b4braceNesting;
+        //this.braceNesting = b4braceNesting;
         //print("ENDFN -1: " + this.ts.lookTok(-1).toString());
         //print("ENDFN 0: " + this.ts.lookTok(0).toString());
         //print("ENDFN 1: " + this.ts.lookTok(1).toString());