X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FScopeParser.js;h=2914d1829abd318d00d25d3de6097b9726dd8632;hb=916df056b7a16402c5258d9f6a3fd0ce865a3ed5;hp=65d60f3f6a4a5e71617b1361fe822dfaa3cefa7e;hpb=45e62d7533ea5dd26f0e6a8b6827b33e1c57b813;p=gnome.introspection-doc-generator diff --git a/JSDOC/ScopeParser.js b/JSDOC/ScopeParser.js index 65d60f3..2914d18 100644 --- a/JSDOC/ScopeParser.js +++ b/JSDOC/ScopeParser.js @@ -141,7 +141,7 @@ ScopeParser.prototype = { this.braceNesting = 0; this.scopes = []; - + print(JSON.stringify(this.ts.tokens, null,4)); this.globalScope = new Scope(-1, false, -1, ''); @@ -258,7 +258,7 @@ ScopeParser.prototype = { while (true) { token = this.ts.nextTok(); //!this.debug|| print( token.toString()); - //print('SCOPE-VAR-VAL:' + token.toString()); + print('SCOPE-VAR-VAL:' + JSON.stringify(token, null, 4)); if (!token) { // can return false at EOF! break; } @@ -300,7 +300,23 @@ ScopeParser.prototype = { } else { //var bn = this.braceNesting; var bn = this.braceNesting; - this.parseExpression(); + var nts = []; + while (true) { + var n = this.ts.lookTok(); + print(n.toString()); + if (!n || n.data == ',') { + break; + } + nts.push(n); + this.ts.nextTok(); + } + if (nts.length) { + var TS = this.ts; + this.ts = new TokenStream(nts); + this.parseExpression(); + this.ts = TS; + } + this.braceNesting = bn; //this.braceNesting = bn; //this.logR("parseScope DONE : ParseExpression - tok is:" + this.ts.lookT(0).toString()); @@ -860,7 +876,13 @@ ScopeParser.prototype = { } token = this.ts.nextTok(); } - + // return function() {.... + if (token.name == "RETURN") { + token = this.ts.nextTok(); + } + if (token.name == "FUNCTION") { + token = this.ts.nextTok(); + } //assert token.getType() == Token.LP; if (this.mode == 'BUILDING_SYMBOL_TREE') { fnScope = new Scope(1, currentScope, token.n, '', token); @@ -872,10 +894,9 @@ ScopeParser.prototype = { } else { //qln("FETCHING SCOPE" + this.ts.cursor); fnScope = this.indexedScopes[token.id]; - } //if (this.mode == 'BUILDING_SYMBOL_TREE') - // print('FUNC-PARSE:' + JSON.stringify(token,null,4)); + // print('FUNC-PARSE:' + JSON.stringify(token,null,4)); // Parse function arguments. var args = token.items; for (var argpos =0; argpos < args.length; argpos++) {