this.scopes = [];
this.indexedScopes = {};
this.timer = new Date() * 1;
-
+ this.debug = false;
}
// list of keywords that should not be used in object literals.
this.ts.rewind();
this.braceNesting = 0;
this.scopes= [];
- this.mode = 'CHECKING_SYMBOL_TREE';
+ this.mode = 'PASS2_SYMBOL_TREE';
//println("MUNGING?");
while (token) {
// this.timerPrint("parseScope AFTER lookT: " + token.toString());
- this.debug|| print(token.type + '.' + token.name+ ":" + token.data);
+ !this.debug|| print(token.type + '.' + token.name+ ":" + token.data);
switch(token.type + '.' + token.name) {
case "KEYW.VAR":
case "KEYW.CONST": // not really relivant as it's only mozzy that does this.
//this.log("parseScope GOT VAR/CONST : " + token.toString());
while (true) {
token = this.ts.nextTok();
- this.debug|| print( token.toString());
+ !this.debug|| print( token.toString());
if (!token) { // can return false at EOF!
break;
}
token = this.ts.nextTok();
- this.debug|| print(token.toString());
+ !this.debug|| print(token.toString());
/*
assert token.getType() == Token.SEMI ||
token.getType() == Token.ASSIGN ||
//this.logR("parseScope DONE : <B>ParseExpression</B> - tok is:" + this.ts.lookT(0).toString());
token = this.ts.lookTok(1);
- this.debug|| print("AFTER EXP: " + token.toString());
+ !this.debug|| print("AFTER EXP: " + token.toString());
if (token.data == ';') {
break;
}
break;
}
symbol = token.data;
- if (this.mode == 'CHECKING_SYMBOL_TREE') {
+ if (this.mode == 'PASS2_SYMBOL_TREE') {
//println("GOT IDENT: -2 : " + this.ts.lookT(-2).toString() + " <BR> ..... -1 : " + this.ts.lookT(-1).toString() + " <BR> ");
-
+ //print ("MUNGE?" + symbol);
//println("GOT IDENT: <B>" + symbol + "</B><BR/>");
// in the same brace nesting, bracket nesting and paren nesting.
// Parse functions if any...
//println("<i>EXP</i><BR/>");
- print("PARSE EXPR");
+ !this.debug || print("PARSE EXPR");
var symbol;
var token;
var currentScope;
currentScope = this.scopes[this.scopes.length-1];
//println("<i>"+token.data+"</i>");
- print ("EXP" + token.toString());
+ !this.debug|| print ("EXP" + token.toString());
switch (token.type) {
case 'PUNC':
switch(token.data) {
break;
}
- if (this.mode == 'CHECKING_SYMBOL_TREE') {
+ if (this.mode == 'PASS2_SYMBOL_TREE') {
identifier = this.getIdentifier(symbol, currentScope);
//println("<B>??</B>");
parseFunctionDeclaration : function()
{
-
+ // print("PARSE FUNCTION");
var symbol;
var token;
var currentScope = false;
// Parse function arguments.
var argpos = 0;
- while (!this.ts.lookTok().data == ')') { //(token = consumeToken()).getType() != Token.RP) {
+ while (this.ts.lookTok().data != ')') { //(token = consumeToken()).getType() != Token.RP) {
token = this.ts.nextTok();
-
+ // print ("FUNC ARGS: " + token.toString())
//assert token.getType() == Token.NAME ||
// token.getType() == Token.COMMA;
if (token.type == 'NAME' && this.mode == 'BUILDING_SYMBOL_TREE') {