X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FScopeParser.js;h=457107d061ba195aafab74604e747fb1462b06fb;hb=4a688d2c8b5710d138f728a03a93776f3f49d5c5;hp=1b7731207e7ab13863ed098a72dd9d4fdc641bce;hpb=2a675f4404cc62cbac76f436efdad426088ec3d8;p=gnome.introspection-doc-generator diff --git a/JSDOC/ScopeParser.js b/JSDOC/ScopeParser.js index 1b77312..457107d 100644 --- a/JSDOC/ScopeParser.js +++ b/JSDOC/ScopeParser.js @@ -328,6 +328,7 @@ ScopeParser.prototype = { case "PUNC.LEFT_CURLY": // { case "PUNC.LEFT_PAREN": // ( + case "PUNC.LEFT_BRACE": // [ //print('SCOPE-CURLY/PAREN:' + token.toString()); //println(""+token.data+""); var curTS = this.ts; @@ -348,7 +349,7 @@ ScopeParser.prototype = { // key value.. this.ts = new TokenStream(token.props[prop].val); - this.parseScope(false); + this.parseExpression(); } this.ts = curTS; @@ -520,10 +521,11 @@ ScopeParser.prototype = { if (symbol == "eval") { // look back one and see if we can find a comment!!! - if (this.ts.look(-1).type == "COMM") { + //if (this.ts.look(-1).type == "COMM") { + if (token.prefix && token.prefix.match('/eval/')) { // look for eval:var:noreplace\n var _t = this; - this.ts.look(-1).data.replace(/eval:var:([a-z_]+)/ig, function(m, a) { + token.prefix.replace(/eval:var:([a-z_]+)/ig, function(m, a) { var hi = _t.getIdentifier(a, thisScope, token); // println("PROTECT "+a+" from munge" + (hi ? "FOUND" : "MISSING")); @@ -627,7 +629,8 @@ ScopeParser.prototype = { case '(': //Token.LP: case '{': //Token.LC: case '[': //Token.LB: - print('SCOPE-CURLY/PAREN/BRACE:' + token.toString()); + //print('SCOPE-CURLY/PAREN/BRACE:' + token.toString()); + // print('SCOPE-CURLY/PAREN/BRACE:' + JSON.stringify(token, null,4)); //println(""+token.data+""); var curTS = this.ts; if (token.props) { @@ -643,7 +646,7 @@ ScopeParser.prototype = { // key value.. this.ts = new TokenStream(token.props[prop].val); - this.parseScope(false); + this.parseExpression(); } this.ts = curTS; @@ -765,10 +768,10 @@ ScopeParser.prototype = { if (this.mode == 'BUILDING_SYMBOL_TREE') { if (symbol == "eval") { - if (this.ts.look(-1).type == 'COMM') { + if (token.prefix && token.prefix.match('/eval/')) { // look for eval:var:noreplace\n var _t = this; - this.ts.look(-1).data.replace(/eval:var:([a-z]+)/ig, function(m, a) { + token.prefix.replace(/eval:var:([a-z]+)/ig, function(m, a) { var hi = _t.getIdentifier(a, currentScope, token); //println("PROTECT "+a+" from munge" + (hi ? "FOUND" : "MISSING")); if (hi) { @@ -857,7 +860,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); @@ -869,10 +878,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++) {