sync
[gnome.introspection-doc-generator] / JSDOC / Collapse.js
index 4f996ad..71a89fd 100644 (file)
@@ -88,10 +88,10 @@ Collapse = XObject.define(
                   //  Seed.print(TokenStream.toString(ret));
                     return ret;
                 }
-                 console.log(tok.data);
+                // console.log(tok.data);
                 switch(tok.type) {
                     case "VOID": 
-                        return; //EOF
+                        return ret; //EOF
                         
                         
                     case "KEYW": 
@@ -121,13 +121,17 @@ Collapse = XObject.define(
                                 if (add) {
                                     add.shift();
                                 }
-                                //Seed.print(TokenStream.toString(aa));
+                                //Seed.print("ADD");
+                                //Seed.print(JSON.stringify(add, null,4));
+                                
                                 
                                 
                                 var toks = add ? this.collapse(add) : [];
                                 tok.items = false;
                                 tok.props = false;
                                 
+                                
+                                
                                 if (tok.data != '{') {
                                     // paramters or array elements..
                                     tok.items = this.toItems(toks, [',']);
@@ -190,6 +194,12 @@ Collapse = XObject.define(
                     g.push(ar[i]);
                     continue;
                 }
+                // var a=..., b =...
+                if ((ar[i].data != ';') && g.length && (g[0].name == "VAR")) {;
+                    g.push(ar[i]);
+                    continue;
+                }
+                
                 g.push(ar[i]);
                 ret.push(g);
                 g = [];
@@ -235,8 +245,9 @@ Collapse = XObject.define(
                    
                 }
             }
-             // last..
-            if (k.length) {
+             // last.. - if g.val.length is 0 then it's a trailing ','...
+             // we should really throw a syntax error in that case..
+            if (k.length && g.val.length) {
                 ret[k] = g;
             }
             return ret;