X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FCollapse.js;h=a0312c003c951f9afee0ddca4c64d0da1b5b4281;hp=3428c1e1dc8d31c8eda141583faf0ed5f70f0beb;hb=db7f0739d8000a3a6acadd881d562ced33a16a3b;hpb=2cee52310ce13f52897614a1476b1395c0ca6981 diff --git a/JSDOC/Collapse.js b/JSDOC/Collapse.js index 3428c1e..a0312c0 100644 --- a/JSDOC/Collapse.js +++ b/JSDOC/Collapse.js @@ -24,7 +24,7 @@ TokenStream = imports.TokenStream.TokenStream; [ ] - collapse into first element. * c) items = , seperation within the above.. * - * + * usage: x = new Collapse(token_array) * * * @@ -62,7 +62,7 @@ Collapse = XObject.define( } tok.prefix = ''; if (pref.length) { - Roo.each(pref, function(e) { + pref.forEach( function(e) { if (!e) { return; } @@ -88,9 +88,11 @@ Collapse = XObject.define( // Seed.print(TokenStream.toString(ret)); return ret; } - // console.log(tok.data); + // console.log(tok.data); switch(tok.type) { - + case "VOID": + return ret; //EOF + case "KEYW": case "TOKN": @@ -109,7 +111,7 @@ Collapse = XObject.define( var start = st.cursor; st.next(1); - var add = st.balance(tok.name); + var add = st.balance(tok.data); if (!add) { console.dump(tok); console.dump(start + '...' + st.cursor); @@ -119,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, [',']); @@ -163,7 +169,7 @@ Collapse = XObject.define( Seed.print("OOPS"); continue; default : - Seed.print("OOPS"); + Seed.print("OOPS" + tok.type); continue; } }