},
warn: function(s) {
- print('****************' + s);
+ //print('****************' + s);
this.warnings.push(s);
//println("WARNING:" + htmlescape(s) + "<BR>");
},
this.mode = 'BUILDING_SYMBOL_TREE';
this.parseScope(this.globalScope);
- print("---------------END PASS 1 ---------------- ");
+ //print("---------------END PASS 1 ---------------- ");
},
mungeSymboltree : function()
log : function(str)
{
- print (" ".substring(0, this.braceNesting) + str);
+ print (" ".substring(0, this.braceNesting*2) + str);
//println("<B>LOG:</B>" + htmlescape(str) + "<BR/>\n");
},
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;
while (token) {
// this.timerPrint("parseScope AFTER lookT: " + token.toString());
- this.logtoken.data);
+ //this.log(token.data);
if (token.type == 'NAME') {
// print('*' + token.data);
}
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 : <B>ParseExpression</B> - tok is:" + this.ts.lookT(0).toString());
token = this.ts.lookTok(1);
//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("<<<<<<<EXIT SCOPE" +this.scopes.length);
return;
}
//if (this.ts.nextT()) break;
}
- print("<<<<<<<EXIT SCOPE ERR?" +this.scopes.length);
+ //print("<<<<<<<EXIT SCOPE ERR?" +this.scopes.length);
},
currentScope = this.scopes[this.scopes.length-1];
//println("<i>"+token.data+"</i>");
- !this.debug|| print ("EXP" + token.toString());
+ //this.log("EXP:" + token.data);
switch (token.type) {
case 'PUNC':
switch(token.data) {
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);
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;
}