JSDOC/Template.js
[gnome.introspection-doc-generator] / JSDOC / Walker2.js
index 7be5639..708a102 100644 (file)
@@ -158,7 +158,7 @@ Walker2 = XObject.define(
                 //print("TOK"+ token.toString());
                 //  this.timerPrint("parseScope AFTER lookT: " + token.toString()); 
                   
-                if (token.tokN == Script.TOKwhitespace) {
+                if (token.is('WHIT')) {
                       
                  
                     if (!token._isDoc) {
@@ -208,8 +208,8 @@ Walker2 = XObject.define(
                 // things that stop comments carrying on...??
                 
                 if (this.currentDoc && (
-                        token.tokN == Script.TOKsemicolon || 
-                        token.tokN == Script.TOKrbrace)) {
+                        token.tokN.data == ';' || 
+                        token.tokN.data == '}')) {
                     this.addSymbol('', true);
                     //throw "Unconsumed Doc ("+ token.toString() +"): " + this.currentDoc.toSource();
                 }
@@ -219,12 +219,12 @@ Walker2 = XObject.define(
                 
                 // var a = b;
                 
-                 if (token.tokN == Script.TOKvar &&
+                 if (token.name == 'VAR' &&
                  
-                        this.ts.lookT(1).tokN == Script.TOKidentifier &&
-                        this.ts.lookT(2).tokN == Script.TOKassign &&
-                        this.ts.lookT(3).tokN == Script.TOKidentifier  &&
-                        this.ts.lookT(4).tokN == Script.TOKsemicolon 
+                        this.ts.lookT(1).type == 'NAME' &&
+                        this.ts.lookT(2).data == '-' &&
+                        this.ts.lookT(3).type == 'NAME'  &&
+                        this.ts.lookT(4).data == ';'  
                         
                  
                  ) {
@@ -244,7 +244,7 @@ Walker2 = XObject.define(
                     // a  << scope
                 // xxx.applyIf(a, {
                     // a  << scope
-                if (token.tokN == Script.TOKidentifier) {
+                if (token.type = 'NAME') {
                     
                     //print("TOK(ident)"+ token.toString());
                     
@@ -253,12 +253,13 @@ Walker2 = XObject.define(
                     
                     
                     if (/\.extend$/.test(token.data) &&
-                        this.ts.lookT(1).tokN == Script.TOKlparen &&
-                        this.ts.lookT(2).tokN == Script.TOKidentifier &&
-                        this.ts.lookT(3).tokN == Script.TOKcomma &&
-                        this.ts.lookT(4).tokN == Script.TOKidentifier &&
-                        this.ts.lookT(5).tokN == Script.TOKcomma &&
-                        this.ts.lookT(6).tokN == Script.TOKlbrace  
+                        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 == '{' 
+                           }
                         ) {
                         // ignore test for ( a and ,
                         this.ts.nextT(); /// (
@@ -293,12 +294,12 @@ Walker2 = XObject.define(
                     // a = Roo.extend(parentname, {
                         
                      if (/\.extend$/.test(token.data) &&
-                        this.ts.lookT(-2).tokN == Script.TOKidentifier &&
-                        this.ts.lookT(-1).tokN == Script.TOKassign &&
-                        this.ts.lookT(1).tokN == Script.TOKlparen &&
-                        this.ts.lookT(2).tokN == Script.TOKidentifier &&
-                        this.ts.lookT(3).tokN == Script.TOKcomma &&
-                        this.ts.lookT(4).tokN == Script.TOKlbrace  
+                        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 == '{' 
                         ) {
                         // ignore test for ( a and ,
                         token = this.ts.lookT(-2);
@@ -328,12 +329,13 @@ Walker2 = XObject.define(
                     }
                     
                     
-                    
+                     // apply ( XXXX,  {
+                         
                     if (/\.(applyIf|apply)$/.test(token.data) && 
-                        this.ts.lookT(1).tokN == Script.TOKlparen &&
-                        this.ts.lookT(2).tokN == Script.TOKidentifier &&
-                        this.ts.lookT(3).tokN == Script.TOKcomma &&
-                        this.ts.lookT(4).tokN == Script.TOKlbrace
+                        this.ts.lookT(1).data == '('  &&
+                        this.ts.lookT(2).type == 'NAME' &&
+                        this.ts.lookT(3).data == ','  &&
+                        this.ts.lookT(4).data == '{' 
                         
                         ) {
                         this.ts.nextT(); /// (
@@ -369,11 +371,11 @@ Walker2 = XObject.define(
                         
                     // change scope to xxxx
                     
-                    if ( this.ts.lookT(1).tokN == Script.TOKassign &&
-                        this.ts.lookT(2).tokN == Script.TOKnew &&
-                        this.ts.lookT(3).tokN == Script.TOKidentifier &&
-                        this.ts.lookT(4).tokN == Script.TOKlparen &&
-                        this.ts.lookT(5).tokN == Script.TOKlbrace
+                    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 == '{' 
                         ) {
                         scopeName = token.data;
                         if (this.currentDoc) {
@@ -430,8 +432,8 @@ Walker2 = XObject.define(
                         // ident = function ()
                         var atype = 'OBJECT';
                         
-                        if (((this.ts.lookT(1).tokN == Script.TOKcolon )|| (this.ts.lookT(1).tokN == Script.TOKassign)) &&
-                            (this.ts.lookT(2).tokN == Script.TOKfunction)
+                        if (((this.ts.lookT(1).data == ':' )|| (this.ts.lookT(1).data == '=')) &&
+                            (this.ts.lookT(2).name == "FUNCTION")
                             ) {
                                 atype = 'FUNCTION';
                         }
@@ -449,7 +451,7 @@ Walker2 = XObject.define(
                     continue; // dont care about other idents..
                     
                 }        
-                if (token.tokN == Script.TOKstring)   {
+                if (token.type == "STRN")   {
                     if (this.currentDoc) {
                         this.addSymbol(token.data.substring(1,token.data.length-1),false,'OBJECT');
 
@@ -459,7 +461,7 @@ Walker2 = XObject.define(
                 // really we only have to deal with object constructs and function calls that change the scope...
                 
                 
-                 if (token.tokN == Script.TOKfunction) {
+                 if (token.name == 'FUNCTION') {
                      
                     // see if we have an unconsumed doc...
                     
@@ -479,11 +481,11 @@ Walker2 = XObject.define(
                     //$this$=foo.prototype|$private$|foo.prototype
         
                     if (
-                            (this.ts.lookT(-1).tokN == Script.TOKassign) && 
-                            (this.ts.lookT(-2).tokN == Script.TOKidentifier)
+                            (this.ts.lookT(-1).data == '=') && 
+                            (this.ts.lookT(-2).type == 'NAME')
                         ) {
                         scopeName = this.ts.lookT(-2).data;
-                        this.ts.balanceN(Script.TOKlparen);
+                        this.ts.balanceN('(');
                         token = this.ts.nextT(); // should be {
                         //print("FOO=FUNCITON() {}" + this.ts.context() + "\n" + token.toString());
                         
@@ -511,9 +513,9 @@ Walker2 = XObject.define(
                         //$private$
                         
                     if (
-                            (this.ts.lookT(-1).tokN == Script.TOKnew) && 
-                            (this.ts.lookT(-2).tokN == Script.TOKassign)
-                            (this.ts.lookT(-3).tokN == Script.TOKidentifier)
+                            (this.ts.lookT(-1).name == 'NEW') && 
+                            (this.ts.lookT(-2).data == '=') &&
+                            (this.ts.lookT(-3).type = 'FUNCTION')
                         ) {
                         //scopeName = this.ts.look(-3).data;
                         this.ts.balanceN(Script.TOKlparen);
@@ -542,9 +544,9 @@ Walker2 = XObject.define(
                     //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() {"); 
                             
@@ -569,10 +571,10 @@ Walker2 = XObject.define(
                         //$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, '');
@@ -593,14 +595,14 @@ Walker2 = XObject.define(
                     
                     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;
@@ -625,16 +627,16 @@ Walker2 = XObject.define(
                     
                 } // 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;
@@ -656,9 +658,9 @@ Walker2 = XObject.define(
                       
                     //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;
@@ -682,7 +684,7 @@ Walker2 = XObject.define(
                     continue;
                     
                 }
-                if (token.tokN == Script.TOKrbrace) {
+                if (token.data == '{') {
                     
                      
                         if (this.currentDoc) {