X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FScopeParser.js;h=20b023314eb71ae5dad96a9cdb09a9de7ca4aea4;hb=170d79543c36554b00d88b791a2de2ad4434c6ab;hp=373a65b522c11afd3b4406dfa886907e8675e0b6;hpb=ff496e9d476bca3d6d2d7b8ba62a8fdd5d1c5f62;p=gnome.introspection-doc-generator diff --git a/JSDOC/ScopeParser.js b/JSDOC/ScopeParser.js index 373a65b..20b0233 100644 --- a/JSDOC/ScopeParser.js +++ b/JSDOC/ScopeParser.js @@ -321,11 +321,12 @@ ScopeParser.prototype = { break; case "PUNC.LEFT_CURLY": // { - + case "PUNC.LEFT_PAREN": // ( + print('SCOPE-CURLY/PAREN:' + token.toString()); //println(""+token.data+""); - + var curTS = this.ts; if (token.props) { - var curTS = this.ts; + for (var prop in token.props) { if (token.props[prop].val.data == 'function') { // parse a function.. @@ -342,18 +343,28 @@ ScopeParser.prototype = { // it's an object literal.. // the values could be replaced.. - + break; } - print('SCOPE-CURLY:' + JSON.stringify(token,null,4)); - print("NOT PROPS"); Seed.quit(); - isObjectLitAr.push(false); - this.braceNesting++; + + var _this = this; + token.items.forEach(function(expr) { + _this.ts = new TokenStream(expr); + _this.parseExpression(scope) + }); + this.ts = curTS; + //print("NOT PROPS"); Seed.quit(); + + //isObjectLitAr.push(false); + //this.braceNesting++; //print(">>>>>> OBJLIT PUSH(false)" + this.braceNesting); break; -/* + case "PUNC.RIGHT_CURLY": // } + print("<< EXIT SCOPE"); + return; + /* //println(""+token.data+""); this.braceNesting--; isObjectLitAr.pop(); @@ -545,6 +556,7 @@ ScopeParser.prototype = { //if (this.ts.nextT()) break; } + print("<<< EXIT SCOPE"); //print("<<<<<<> ENTER EXPRESSION" + this.expN); - while (token = this.ts.lookTok()) { + while (token = this.ts.nextTok()) { - + /* // moved out of loop? @@ -592,69 +604,83 @@ ScopeParser.prototype = { */ //this.dumpToken(token, this.scopes, this.braceNesting ); - //print('EXP' + this.expN + ':' + token.toString()); + print('EXP' + token.toString()); //println(""+token.data+""); //this.log("EXP:" + token.data); switch (token.type) { case 'PUNC': - print("EXPR-PUNC:" + JSON.stringify(token, null, 4)); + print("EXPR-PUNC:" + token.toString()); switch(token.data) { case ';': + print("<< EXIT EXPRESSION"); + break; + case ',': - if (this.braceNesting == expressionBraceNesting && - bracketNesting == 0 && - parensNesting == 0) { - print("<< EXIT EXPRESSION"); - this.expN--; - return; - } + break; - + case '(': //Token.LP: case '{': //Token.LC: - isObjectLitAr.push(false); + case '[': //Token.LB: + print('SCOPE-CURLY/PAREN/BRACE:' + token.toString()); + //println(""+token.data+""); + var curTS = this.ts; + if (token.props) { + + for (var prop in token.props) { + if (token.props[prop].val.data == 'function') { + // parse a function.. + this.parseFunctProp(token.props[prop]); + continue; + } + // key value.. + + this.ts = new TokenStream(token.props[prop].val); + this.parseScope(currentScope); + + } + this.ts = curTS; + + // it's an object literal.. + // the values could be replaced.. + break; + } - this.braceNesting++; + + var _this = this; + token.items.forEach(function(expr) { + _this.ts = new TokenStream(expr); + _this.parseExpression() + }); + this.ts = curTS; + + + ///print(">>>>> EXP PUSH(false)"+this.braceNesting); break; - case '}': //Token.RC: - this.braceNesting--; - isObjectLitAr.pop(); - //print(">>>>> EXP POP" + this.braceNesting); - // assert braceNesting >= expressionBraceNesting; - break; - - case '[': //Token.LB: + - var ts = this.ts; - var _this = this; - token.items.forEach(function(ns) { - print("EXPR-PUNC[:" + JSON.stringify(ns, null, 4)); - _this.ts = new TokenStream(ns); - _this.ts.cursor--; - _this.parseExpression(); - }); - this.ts = ts; + - break; -/* + case ')': //Token.RP: case ']': //Token.RB: - bracketNesting--; - break; -*/ - case '(': //Token.LP: + case '}': //Token.RB: + print("<< EXIT EXPRESSION"); + return; + + + parensNesting++; break; - case ')': //Token.RP: - parensNesting--; - break; + + } break; @@ -744,7 +770,7 @@ ScopeParser.prototype = { //println("EID"); - case 'KEYW': + case 'KEYW': print("EXPR-KEYW:" + JSON.stringify(token, null, 4)); if (token.name == "FUNCTION") { @@ -781,9 +807,11 @@ ScopeParser.prototype = { } break; } - + default: + print("EXPR-SKIP:" + JSON.stringify(token, null, 4)); + break; } - if (!this.ts.nextTok()) break; + } print("<< EXIT EXPRESSION"); this.expN--;