JSDOC/TokenStream.vala
authorAlan Knowles <alan@roojs.com>
Wed, 30 Sep 2015 09:55:02 +0000 (17:55 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 30 Sep 2015 09:55:02 +0000 (17:55 +0800)
JSDOC/TokenStream.vala

index bee4922..51942dd 100644 (file)
@@ -100,7 +100,7 @@ namespace JSDOC {
             * look ahead (or back) x number of tokens (which are not comment or whitespace)
             * ?? used any more?
             */
-           public Token? lookTok (int n) {
+           public Token lookTok (int n) {
 
 
                
@@ -116,12 +116,14 @@ namespace JSDOC {
                            continue;
                            
                        }
-                       return   new Token("", "VOID", "END_OF_STREAM");
+                       return  new Token("", "VOID", "END_OF_STREAM");
                    }
-                   else if (i > this.tokens.length) return  new Token("", "VOID", "END_OF_STREAM");
+                   if (i > this.tokens.length) {
+                               return  new Token("", "VOID", "END_OF_STREAM");
+                       }
 
-                   if (i != this.cursor && (this.tokens[i] === undefined || this.tokens[i].is("WHIT") || this.tokens[i].is("COMM"))) {
-                       if (n < 0) i--; else i++;
+                   if (i != this.cursor && ( this.tokens.get(i).is("WHIT") || this.tokens.get(i).is("COMM"))) {
+                       i += (n < 0) ? -1 : 1;
                        continue;
                    }