X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=JSDOC%2FScopeParser.js;h=1b315b0b6c5c87a40c9109f8ddf8d4d0579a33c4;hp=1c38b44b68387378ea19622b9f5f4e6b857be9fa;hb=d56985f1898989ac6236528f762e69837f185914;hpb=b0546689883015b64adcde131b32099c504834ff diff --git a/JSDOC/ScopeParser.js b/JSDOC/ScopeParser.js index 1c38b44..1b315b0 100644 --- a/JSDOC/ScopeParser.js +++ b/JSDOC/ScopeParser.js @@ -98,7 +98,7 @@ ScopeParser.prototype = { }, warn: function(s) { - print('****************' + s); + //print('****************' + s); this.warnings.push(s); //println("WARNING:" + htmlescape(s) + "
"); }, @@ -133,7 +133,7 @@ ScopeParser.prototype = { this.mode = 'BUILDING_SYMBOL_TREE'; this.parseScope(this.globalScope); - print("---------------END PASS 1 ---------------- "); + //print("---------------END PASS 1 ---------------- "); }, mungeSymboltree : function() @@ -178,7 +178,7 @@ ScopeParser.prototype = { log : function(str) { - print (" ".substring(0, this.braceNesting) + str); + print (" ".substring(0, this.braceNesting*2) + str); //println("LOG:" + htmlescape(str) + "
\n"); }, @@ -195,7 +195,7 @@ ScopeParser.prototype = { parseScope : function(scope) // parse a token stream.. { //this.timerPrint("parseScope EnterScope"); - print(">>> ENTER SCOPE" + this.scopes.length); + //this.log(">>> ENTER SCOPE" + this.scopes.length); var symbol; var token; @@ -212,7 +212,7 @@ ScopeParser.prototype = { while (token) { // this.timerPrint("parseScope AFTER lookT: " + token.toString()); - this.log(token.type + '.' + token.name+ ":" + token.data); + //this.log(token.data); if (token.type == 'NAME') { // print('*' + token.data); } @@ -228,12 +228,15 @@ ScopeParser.prototype = { if (!token) { // can return false at EOF! break; } - if (token.name == "VAR") { // kludge.. + if (token.name == "VAR" || token.data == ',') { // kludge.. continue; } //this.logR("parseScope GOT VAR : " + token.toString() + ""); if (token.type !="NAME") { - print(token.toString()); + for(var i = Math.max(this.ts.cursor-10,0); i < this.ts.cursor+1; i++) { + print(this.ts.tokens[i].toString()); + } + print( "var without ident"); Seed.quit() } @@ -261,9 +264,9 @@ ScopeParser.prototype = { if (token.name == "IN") { break; } else { - var bn = this.braceNesting; + //var bn = this.braceNesting; this.parseExpression(); - this.braceNesting = bn; + //this.braceNesting = bn; //this.logR("parseScope DONE : ParseExpression - tok is:" + this.ts.lookT(0).toString()); token = this.ts.lookTok(1); @@ -296,9 +299,14 @@ ScopeParser.prototype = { //print(">>>>>> OBJLIT POP"+ this.braceNesting); //assert braceNesting >= scope.getBra ceNesting(); - if (this.braceNesting < 0) { + if (this.braceNesting < expressionBraceNesting) { var ls = this.scopes.pop(); ls.getUsedSymbols(); + // eat symbol if we are currently at { + if (this.ts.look(0).data == '{') { + this.ts.nextTok(); + } + //print("<<<<<<"+token.data+""); - !this.debug|| print ("EXP" + token.toString()); + //this.log("EXP:" + token.data); switch (token.type) { case 'PUNC': switch(token.data) { @@ -577,7 +585,8 @@ ScopeParser.prototype = { case 'NAME': symbol = token.data; - if (this.ts.lookTok(-1).data == "{" && this.ts.lookTok(1).data == ":") { + + if (this.ts.look(0).data == "{" && this.ts.lookTok(2).data == ":") { // then we are in an object lit.. -> we need to flag the brace as such... isObjectLitAr.pop(); isObjectLitAr.push(true); @@ -585,11 +594,11 @@ ScopeParser.prototype = { break; } isInObjectLitAr = isObjectLitAr[isObjectLitAr.length-1]; - if (isInObjectLitAr && this.ts.lookTok(-1).data == "," && this.ts.lookTok(1).data == ":") { + if (isInObjectLitAr && this.ts.lookTok(0).data == "," && this.ts.lookTok(2).data == ":") { break; } - - if (this.ts.lookTok(-1).data == ".") { + //print(this.ts.lookTok(0).data); + if (this.ts.lookTok(0).data == ".") { //skip '.' break; } @@ -734,7 +743,7 @@ ScopeParser.prototype = { this.indexedScopes[this.ts.cursor] = fnScope; } else { - //println("FETCHING SCOPE" + this.ts.cursor); + //qln("FETCHING SCOPE" + this.ts.cursor); fnScope = this.indexedScopes[this.ts.cursor]; }