this.mode = 'BUILDING_SYMBOL_TREE';
this.parseScope(this.globalScope);
+
},
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());
+ while (null != (token = this.ts.next())) {
+ print("TOK"+ token.toString());
// this.timerPrint("parseScope AFTER lookT: " + token.toString());
- if (token.is('WHIT')) {
+ if (token.is('COMM')) {
- if (!token._isDoc) {
+ if (token.name != 'JSDOC') {
+ print("Walker2 : spce is not JSDOC");
continue; //skip.
}
if (this.currentDoc) {
this.addSymbol('', true);
-
//throw "Unconsumed Doc (TOKwhitespace): " + this.currentDoc.toSource();
}
// it's a scope changer..
if (newDoc.getTag("scope").length) {
- //print(newDoc.getTag("scope").toSource());
+ print("Walker2 : doctag changes scope");
//throw "done";
scope.ident = '$private$|' + newDoc.getTag("scope")[0].desc;
continue;
if (newDoc.getTag("scopeAlias").length) {
//print(newDoc.getTag("scopeAlias").toSource());
// @scopeAlias a=b
+ print("Walker2 : doctag changes scope (alias)");
var sal = newDoc.getTag("scopeAlias")[0].desc.split("=");
aliases[sal[0]] = sal[1];
/// got a doc comment..
//token.data might be this.??? (not sure though)
+ print("Walker2 : setting currentDoc");
this.currentDoc = newDoc;
continue;
}
if (token.name == 'VAR' &&
- this.ts.lookT(1).type == 'NAME' &&
- this.ts.lookT(2).data == '-' &&
- this.ts.lookT(3).type == 'NAME' &&
- this.ts.lookT(4).data == ';'
+ this.ts.lookTok(1).type == 'NAME' &&
+ this.ts.lookTok(2).data == '-' &&
+ this.ts.lookTok(3).type == 'NAME' &&
+ this.ts.lookTok(4).data == ';'
) {
- //print("SET ALIAS:" + this.ts.lookT(1).data +'=' + this.ts.lookT(3).data);
+ //print("SET ALIAS:" + this.ts.lookTok(1).data +'=' + this.ts.lookTok(3).data);
- aliases[this.ts.lookT(1).data] = this.ts.lookT(3).data;
+ aliases[this.ts.lookTok(1).data] = this.ts.lookTok(3).data;
}
if (/\.extend$/.test(token.data) &&
- this.ts.lookT(1).data == '(' &&
- this.ts.lookT(2).type == 'NAME' &&
- this.ts.lookT(3).data == ',' &&
- this.ts.lookT(4).type == 'NAME' &&
- this.ts.lookT(5).data == ',' &&
- this.ts.lookT(6).data == '{'
- }
+ this.ts.lookTok(1).data == '(' &&
+ this.ts.lookTok(2).type == 'NAME' &&
+ this.ts.lookTok(3).data == ',' &&
+ this.ts.lookTok(4).type == 'NAME' &&
+ this.ts.lookTok(5).data == ',' &&
+ this.ts.lookTok(6).data == '{'
+
) {
// ignore test for ( a and ,
- this.ts.nextT(); /// (
- token = this.ts.nextT(); // a
+ this.ts.nextTok(); /// (
+ token = this.ts.nextTok(); // a
scopeName = token.data;
if (this.currentDoc) {
this.addSymbol(scopeName,false,'OBJECT');
}
- this.ts.nextT(); // ,
- this.ts.nextT(); // b
+ this.ts.nextTok(); // ,
+ this.ts.nextTok(); // b
- this.ts.nextT(); // ,
- token = this.ts.nextT(); // {
+ this.ts.nextTok(); // ,
+ token = this.ts.nextTok(); // {
scopeName = fixAlias(scopeName);
// a = Roo.extend(parentname, {
if (/\.extend$/.test(token.data) &&
- this.ts.lookT(-2).type == 'NAME' &&
- this.ts.lookT(-1).data == '=' &&
- this.ts.lookT(1).data == '(' &&
- this.ts.lookT(2).type == 'NAME' &&
- this.ts.lookT(3).data == ',' &&
- this.ts.lookT(4).data == '{'
+ this.ts.lookTok(-2).type == 'NAME' &&
+ this.ts.lookTok(-1).data == '=' &&
+ this.ts.lookTok(1).data == '(' &&
+ this.ts.lookTok(2).type == 'NAME' &&
+ this.ts.lookTok(3).data == ',' &&
+ this.ts.lookTok(4).data == '{'
) {
// ignore test for ( a and ,
- token = this.ts.lookT(-2);
+ token = this.ts.lookTok(-2);
scopeName = token.data;
if (this.currentDoc) {
this.addSymbol(scopeName,false,'OBJECT');
}
- this.ts.nextT(); /// (
- this.ts.nextT(); // parent
+ this.ts.nextTok(); /// (
+ this.ts.nextTok(); // parent
- this.ts.nextT(); // ,
- token = this.ts.nextT(); // {
+ this.ts.nextTok(); // ,
+ token = this.ts.nextTok(); // {
scopeName = fixAlias(scopeName);
// apply ( XXXX, {
-
+ /*
+ print(JSON.stringify([
+ token.data,
+ this.ts.lookTok(1).data ,
+ this.ts.lookTok(2).type ,
+ this.ts.lookTok(3).data ,
+ this.ts.lookTok(4).data
+ ], null, 4));
+ */
+
if (/\.(applyIf|apply)$/.test(token.data) &&
- this.ts.lookT(1).data == '(' &&
- this.ts.lookT(2).type == 'NAME' &&
- this.ts.lookT(3).data == ',' &&
- this.ts.lookT(4).data == '{'
+ this.ts.lookTok(1).data == '(' &&
+ this.ts.lookTok(2).type == 'NAME' &&
+ this.ts.lookTok(3).data == ',' &&
+ this.ts.lookTok(4).data == '{'
) {
- this.ts.nextT(); /// (
+ this.ts.nextTok(); /// (
//print("GOT : applyIF!");
- token = this.ts.nextT(); // b
+ token = this.ts.nextTok(); // b
scopeName = token.data;
if (this.currentDoc) {
this.addSymbol(scopeName,false,'OBJECT');
-
}
- this.ts.nextT(); /// ,
- this.ts.nextT(); // {
- scopeName = fixAlias(scopeName);
+ this.ts.nextTok(); /// ,
+ this.ts.nextTok(); // {
+ scopeName = fixAlias(scopeName);
var fnScope = new Scope(this.braceNesting, scope, token.n, scopeName);
this.indexedScopes[this.ts.cursor] = fnScope;
scope = fnScope;
// xxx = new yyy ( {
// change scope to xxxx
-
- if ( this.ts.lookT(1).data == '=' &&
- this.ts.lookT(2).name == 'NEW' &&
- this.ts.lookT(3).type == 'NAME' &&
- this.ts.lookT(4).data == '(' &&
- this.ts.lookT(5)..data == '{'
+ /*
+ print(JSON.stringify([
+ this.ts.lookTok(1).data ,
+ this.ts.lookTok(2).name ,
+ this.ts.lookTok(3).type ,
+ this.ts.lookTok(4).data ,
+ this.ts.lookTok(5).data
+ ], null, 4));
+ */
+ if ( this.ts.lookTok(1).data == '=' &&
+ this.ts.lookTok(2).name == 'NEW' &&
+ this.ts.lookTok(3).type == 'NAME' &&
+ this.ts.lookTok(4).data == '(' &&
+ this.ts.lookTok(5).data == '{'
) {
scopeName = token.data;
if (this.currentDoc) {
}
- this.ts.nextT(); /// =
- this.ts.nextT(); /// new
- this.ts.nextT(); /// yyy
- this.ts.nextT(); /// (
- this.ts.nextT(); /// {
+ this.ts.nextTok(); /// =
+ this.ts.nextTok(); /// new
+ this.ts.nextTok(); /// yyy
+ this.ts.nextTok(); /// (
+ this.ts.nextTok(); /// {
scopeName = fixAlias(scopeName);
var fnScope = new Scope(this.braceNesting, scope, token.n, scopeName);
// ident = function ()
var atype = 'OBJECT';
- if (((this.ts.lookT(1).data == ':' )|| (this.ts.lookT(1).data == '=')) &&
- (this.ts.lookT(2).name == "FUNCTION")
+ if (((this.ts.lookTok(1).data == ':' )|| (this.ts.lookTok(1).data == '=')) &&
+ (this.ts.lookTok(2).name == "FUNCTION")
) {
atype = 'FUNCTION';
}
- //print("ADD SYM:" + atype + ":" + token.toString() + this.ts.lookT(1).toString() + this.ts.lookT(2).toString());
+ //print("ADD SYM:" + atype + ":" + token.toString() + this.ts.lookTok(1).toString() + this.ts.lookTok(2).toString());
this.addSymbol(
- this.ts.lookT(-1).tokN == Script.TOKdot ? token.data : fixAlias(token.data),
+ this.ts.lookTok(-1).tokN == Script.TOKdot ? token.data : fixAlias(token.data),
false,
atype);
//$this$=foo.prototype|$private$|foo.prototype
if (
- (this.ts.lookT(-1).data == '=') &&
- (this.ts.lookT(-2).type == 'NAME')
+ (this.ts.lookTok(-1).data == '=') &&
+ (this.ts.lookTok(-2).type == 'NAME')
) {
- scopeName = this.ts.lookT(-2).data;
+ scopeName = this.ts.lookTok(-2).data;
this.ts.balanceN('(');
- token = this.ts.nextT(); // should be {
+ token = this.ts.nextTok(); // should be {
//print("FOO=FUNCITON() {}" + this.ts.context() + "\n" + token.toString());
scopeName = fixAlias(scopeName);
var fnScope = new Scope(this.braceNesting, scope, token.n,
'$this$='+scopeName+'.prototype|$private$|'+scopeName+'.prototype');
+
this.indexedScopes[this.ts.cursor] = fnScope;
//scope = fnScope;
//this.scopesIn(fnScope);
//$private$
if (
- (this.ts.lookT(-1).name == 'NEW') &&
- (this.ts.lookT(-2).data == '=') &&
- (this.ts.lookT(-3).type = 'FUNCTION')
+ (this.ts.lookTok(-1).name == 'NEW') &&
+ (this.ts.lookTok(-2).data == '=') &&
+ (this.ts.lookTok(-3).type = 'FUNCTION')
) {
//scopeName = this.ts.look(-3).data;
this.ts.balanceN(Script.TOKlparen);
- token = this.ts.nextT(); // should be {
+ token = this.ts.nextTok(); // should be {
scopeName = fixAlias(scopeName);
var fnScope = new Scope(this.braceNesting, scope, token.n, '$private$');
this.indexedScopes[this.ts.cursor] = fnScope;
// no change to scoping..
//print("checking for : function() {");
- //print( [this.ts.lookT(-3).type , this.ts.lookT(-2).type , this.ts.lookT(-1).type ].join(":"));
+ //print( [this.ts.lookTok(-3).type , this.ts.lookTok(-2).type , this.ts.lookTok(-1).type ].join(":"));
if (
- (this.ts.lookT(-1).data == ':') &&
- (this.ts.lookT(-2).type == 'NAME') &&
- (this.ts.lookT(-3).data == '(' || this.ts.lookT(-3).data== ',')
+ (this.ts.lookTok(-1).data == ':') &&
+ (this.ts.lookTok(-2).type == 'NAME') &&
+ (this.ts.lookTok(-3).data == '(' || this.ts.lookTok(-3).data== ',')
) {
//print("got for : function() {");
//scopeName = this.ts.look(-3).data;
this.ts.balanceN(Script.TOKlparen);
//print(token.toString())
- token = this.ts.nextT(); // should be {
+ token = this.ts.nextTok(); // should be {
//print(token.toString())
scopeName = fixAlias(scopeName);
var fnScope = new Scope(this.braceNesting, scope, token.n, '');
//$this$=foo
if (
- (this.ts.lookT(1).type == 'NAME')
+ (this.ts.lookTok(1).type == 'NAME')
) {
//scopeName = this.ts.look(-3).data;
this.ts.balanceN('(');
- token = this.ts.nextT(); // should be {
+ token = this.ts.nextTok(); // should be {
var fnScope = new Scope(this.braceNesting, scope, token.n, '');
this.indexedScopes[this.ts.cursor] = fnScope;
// RETURN function(...) {
if (
- // (this.ts.lookT(-1).tokN == Script.TOKlparen) &&
- (this.ts.lookT(1).name != 'NAME')
+ // (this.ts.lookTok(-1).tokN == Script.TOKlparen) &&
+ (this.ts.lookTok(1).name != 'NAME')
- // (this.ts.lookT(-2).tokN == Script.TOKnew) &&
- // (this.ts.lookT(-3).tokN == Script.TOKassign) &&
- // (this.ts.lookT(-4).tokN == Script.TOKidentifier)
+ // (this.ts.lookTok(-2).tokN == Script.TOKnew) &&
+ // (this.ts.lookTok(-3).tokN == Script.TOKassign) &&
+ // (this.ts.lookTok(-4).tokN == Script.TOKidentifier)
) {
//scopeName = this.ts.look(-3).data;
this.ts.balanceN('(');
- token = this.ts.nextT(); // should be {
+ token = this.ts.nextTok(); // should be {
var fnScope = new Scope(this.braceNesting, scope, token.n, '$private$');
this.indexedScopes[this.ts.cursor] = fnScope;
//scope = ;
if (
- (this.ts.lookT(-1).data == '=') &&
- (this.ts.lookT(-2).type == 'NAME') &&
- (this.ts.lookT(-3).nane != 'VAR')
+ (this.ts.lookTok(-1).data == '=') &&
+ (this.ts.lookTok(-2).type == 'NAME') &&
+ (this.ts.lookTok(-3).nane != 'VAR')
) {
scopeName = this.ts.look(-2).data;
//print("GOT LBRACE : check for :");
if (
- (this.ts.lookT(-1).data == ':') &&
- (this.ts.lookT(-2).type == 'NAME') &&
- (this.ts.lookT(-3).name != 'VAR')
+ (this.ts.lookTok(-1).data == ':') &&
+ (this.ts.lookTok(-2).type == 'NAME') &&
+ (this.ts.lookTok(-3).name != 'VAR')
) {
- scopeName = this.ts.lookT(-2).data;
+ scopeName = this.ts.lookTok(-2).data;
scopeName = fixAlias(scopeName);
var fnScope = new Scope(this.braceNesting, scope, token.n, scopeName);
this.indexedScopes[this.ts.cursor] = fnScope;
addSymbol: function(lastIdent, appendIt, atype )
{
-
+ print("addSymbol : " + lastIndent);
/*if (!this.currentDoc.tags.length) {