X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FScopeParser.vala;h=cfbe82f808bcbc03262345649ed8c8be17147d43;hb=68c24ae947a42e091504c6d1df4e7684c7da25d1;hp=44e1ca12e5b88aae1844eb0e027ba49a87c6d3d2;hpb=783b02009eb0a165688f7e20e95ae1f6c421a8f8;p=gnome.introspection-doc-generator diff --git a/JSDOC/ScopeParser.vala b/JSDOC/ScopeParser.vala index 44e1ca1..cfbe82f 100644 --- a/JSDOC/ScopeParser.vala +++ b/JSDOC/ScopeParser.vala @@ -24,7 +24,7 @@ namespace JSDOC { Gee.HashMap indexedScopes; bool munge = true; - + int expN = 0; public ScopeParser(TokenStream ts) { this.ts = ts; // {TokenStream} @@ -252,7 +252,7 @@ namespace JSDOC { //this.logR("parseScope GOT VAR : " + token.toString() + ""); if (token.type != "NAME") { - for(var i = Int.max(this.ts.cursor-10,0); i < this.ts.cursor+1; i++) { + for(var i = int.max(this.ts.cursor-10,0); i < this.ts.cursor+1; i++) { print(this.ts.tokens[i].toString()); } @@ -397,7 +397,7 @@ namespace JSDOC { case "KEYW.WITH": //print('SCOPE-WITH:' + token.toString()); //println(""+token.data+""); - if (this.mode == "BUILDING_SYMBOL_TREE") { + if (this.mode == ScopeParserMode.BUILDING_SYMBOL_TREE) { // Inside a 'with' block, it is impossible to figure out // statically whether a symbol is a local variable or an // object member. As a consequence, the only thing we can @@ -419,21 +419,22 @@ namespace JSDOC { // print('SCOPE-STRING:' + token.toString()); //println(""+token.data+""); - if (this.ts.lookTok(-1).data == '{' && this.ts.lookTok(1).data == ':') { + if (this.ts.lookTok(-1).data == "{" && this.ts.lookTok(1).data == ":") { // then we are in an object lit.. -> we need to flag the brace as such... - isObjectLitAr.pop(); - isObjectLitAr.push(true); + isObjectLitAr.remove_at(isObjectLitAr.size-1); + isObjectLitAr.add(true); //print(">>>>>> OBJLIT REPUSH(true)"); } - isInObjectLitAr = isObjectLitAr[isObjectLitAr.length-1]; + isInObjectLitAr = isObjectLitAr.get(isObjectLitAr.size-1); - if (isInObjectLitAr && this.ts.lookTok(1).data == ':' && - ( this.ts.lookTok(-1).data == '{' || this.ts.lookTok(-1).data == ':' )) { + if (isInObjectLitAr && this.ts.lookTok(1).data == ":" && + ( this.ts.lookTok(-1).data == "{" || this.ts.lookTok(-1).data == ":" )) { // see if we can replace.. // remove the quotes.. // should do a bit more checking!!!! (what about wierd char's in the string.. var str = token.data.substring(1,token.data.length-1); - if (/^[a-z_]+$/i.test(str) && ScopeParser.idents.indexOf(str) < 0) { + + if (Regex.match_simple ("^[a-z_]+$", str) && this.idents.index_of(str) < 0) { token.outData = str; } @@ -458,10 +459,11 @@ namespace JSDOC { //print("SYMBOL: " + token.toString()); symbol = token.data; - if (symbol == 'this') { + if (symbol == "this") { break; } - if (this.mode == 'PASS2_SYMBOL_TREE') { + + if (this.mode == ScopeParserMode.PASS2_SYMBOL_TREE) { //println("GOT IDENT: -2 : " + this.ts.lookT(-2).toString() + "
..... -1 : " + this.ts.lookT(-1).toString() + "
"); @@ -480,7 +482,7 @@ namespace JSDOC { // We don't need to declare longer symbols since they won't cause // any conflict with other munged symbols. this.globalScope.declareIdentifier(symbol, token); - this.warn("Found an undeclared symbol: " + symbol + ' (line:' + token.line + ')', true); + this.warn("Found an undeclared symbol: " + symbol + " (line:" + token.line + ")", true); } //println("GOT IDENT IGNORE(3): " + symbol + "
"); @@ -493,7 +495,7 @@ namespace JSDOC { break; //println("SID"); default: - if (token.type != 'KEYW') { + if (token.type != "KEYW") { break; } //print('SCOPE-KEYW:' + token.toString()); @@ -501,7 +503,7 @@ namespace JSDOC { symbol = token.data; - if (this.mode == 'BUILDING_SYMBOL_TREE') { + if (this.mode == ScopeParserMode.BUILDING_SYMBOL_TREE) { if (token.name == "EVAL") { @@ -512,6 +514,8 @@ namespace JSDOC { // look for eval:var:noreplace\n //print("MATCH!?"); var _t = this; + + token.prefix.replace(/eval:var:([a-z_]+)/ig, function(m, a) { //print("GOT: " + a); var hi = _t.getIdentifier(a, scope, token); @@ -548,9 +552,10 @@ namespace JSDOC { } //print("<<< EXIT SCOPE"); //print("<<<<<<