var scopeLen = this.scopes.length;
if (this.ts.cursor < 1) {
- this.ts.cursor--; // hopeflly this kludge will work
- }
-
+ this.ts.cursor--; // hopeflly this kludge will work
+ }
+ //print(JSON.stringify(this.ts, null, 4)); Seed.quit();
while (false != (token = this.ts.next())) {
- //print("TOK"+ token.toString());
+ print("TOK"+ token.toString());
// this.timerPrint("parseScope AFTER lookT: " + token.toString());
if (token.is('WHIT')) {
this.ts.lookT(4).type == 'NAME' &&
this.ts.lookT(5).data == ',' &&
this.ts.lookT(6).data == '{'
- }
+
) {
// ignore test for ( a and ,
this.ts.nextT(); /// (
this.ts.lookT(2).name == 'NEW' &&
this.ts.lookT(3).type == 'NAME' &&
this.ts.lookT(4).data == '(' &&
- this.ts.lookT(5)..data == '{'
+ this.ts.lookT(5).data == '{'
) {
scopeName = token.data;
if (this.currentDoc) {
//print("checking for : function() {");
//print( [this.ts.lookT(-3).type , this.ts.lookT(-2).type , this.ts.lookT(-1).type ].join(":"));
if (
- (this.ts.lookT(-1).tokN == Script.TOKcolon) &&
- (this.ts.lookT(-2).tokN == Script.TOKidentifier) &&
- (this.ts.lookT(-3).tokN == Script.TOKlbrace || this.ts.lookT(-3).tokN == Script.TOKcomma)
+ (this.ts.lookT(-1).data == ':') &&
+ (this.ts.lookT(-2).type == 'NAME') &&
+ (this.ts.lookT(-3).data == '(' || this.ts.lookT(-3).data== ',')
) {
//print("got for : function() {");
//$this$=foo
if (
- (this.ts.lookT(1).tokN == Script.TOKidentifier)
+ (this.ts.lookT(1).type == 'NAME')
) {
//scopeName = this.ts.look(-3).data;
- this.ts.balanceN(Script.TOKlparen);
+ this.ts.balanceN('(');
token = this.ts.nextT(); // should be {
var fnScope = new Scope(this.braceNesting, scope, token.n, '');
if (
// (this.ts.lookT(-1).tokN == Script.TOKlparen) &&
- (this.ts.lookT(1).tokN != Script.TOKidentifier)
+ (this.ts.lookT(1).name != 'NAME')
// (this.ts.lookT(-2).tokN == Script.TOKnew) &&
// (this.ts.lookT(-3).tokN == Script.TOKassign) &&
// (this.ts.lookT(-4).tokN == Script.TOKidentifier)
) {
//scopeName = this.ts.look(-3).data;
- this.ts.balanceN(Script.TOKlparen);
+ this.ts.balanceN('(');
token = this.ts.nextT(); // should be {
var fnScope = new Scope(this.braceNesting, scope, token.n, '$private$');
this.indexedScopes[this.ts.cursor] = fnScope;
} // end checking for TOKfunction
- if (token.tokN == Script.TOKlbrace) {
+ if (token.data == '{') {
// foo = { // !var!!!
//$this$=foo|Foo
if (
- (this.ts.lookT(-1).tokN == Script.TOKassign) &&
- (this.ts.lookT(-2).tokN == Script.TOKidentifier) &&
- (this.ts.lookT(-3).tokN != Script.TOKvar)
+ (this.ts.lookT(-1).data == '=') &&
+ (this.ts.lookT(-2).type == 'NAME') &&
+ (this.ts.lookT(-3).nane != 'VAR')
) {
scopeName = this.ts.look(-2).data;
//print("GOT LBRACE : check for :");
if (
- (this.ts.lookT(-1).tokN == Script.TOKcolon) &&
- (this.ts.lookT(-2).tokN == Script.TOKidentifier) &&
- (this.ts.lookT(-3).tokN != Script.TOKvar)
+ (this.ts.lookT(-1).data == ':') &&
+ (this.ts.lookT(-2).type == 'NAME') &&
+ (this.ts.lookT(-3).name != 'VAR')
) {
scopeName = this.ts.lookT(-2).data;
continue;
}
- if (token.tokN == Script.TOKrbrace) {
+ if (token.data == '{') {
if (this.currentDoc) {