JSDOC/TokenReader.vala
authorAlan Knowles <alan@roojs.com>
Thu, 10 Sep 2015 10:44:30 +0000 (18:44 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 10 Sep 2015 10:44:30 +0000 (18:44 +0800)
JSDOC/TokenReader.vala

index a971019..9827db3 100644 (file)
@@ -173,27 +173,32 @@ namespace JSDOC {
         /**
             @returns {Boolean} Was the token found?
          */
-        public bool read_word (TokenStream stream, TokenArray tokens) {
-            var found = "";
+        public bool read_word (TokenStream stream, TokenArray tokens)
+        {
+            string found = "";
             while (!stream.lookEOF() && Lang.isWordChar(stream.look())) {
                 found += stream.next();
             }
             
-            if (found === "") {
+            if (found == "") {
                 return false;
             }
             
-            var name;
-            if ((name = Lang.keyword(found))) {
-                if (found == 'return' && tokens.lastSym().data == ')') {
+            var name = Lang.keyword(found);
+            if (name) {
+                
+                // look for () return  ?? why ???
+                
+                if (found == "return" && tokens.lastSym().data == ")") {
                     //Seed.print('@' + tokens.length);
-                    var n = this.findPuncToken(tokens, ')');
+                    var n = this.findPuncToken(tokens, ")");
                     //Seed.print(')@' + n);
-                    n = this.findPuncToken(tokens, '(', n-1);
+                    n = this.findPuncToken(tokens, "(", n-1);
                     //Seed.print('(@' + n);
                     
                     var lt = this.lastSym(tokens, n);
-                    print(JSON.stringify(lt));
+                    
+                    //print(JSON.stringify(lt));
                     if (lt.type != 'KEYW' || ['IF', 'WHILE'].indexOf(lt.name) < -1) {
                         if (!this.ignoreBadGrammer) {
                             throw {