JSDOC/TokenReader.js
[gnome.introspection-doc-generator] / JSDOC / TokenStream.js
index 55039a9..a660873 100644 (file)
@@ -1,13 +1,13 @@
 //<script type="text/javscript">
 
 
-XObject = imports.XObject.XObject;
+const XObject = imports.XObject.XObject;
  
 
 
-console = imports.console.console;
-Token   = imports.Token.Token;
-Lang    = imports.Lang.Lang;
+const console = imports.console.console;
+const Token   = imports.Token.Token;
+const Lang    = imports.Lang.Lang;
 
 
 /**
@@ -21,7 +21,7 @@ Lang    = imports.Lang.Lang;
  */
        
  
-TokenStream = XObject.define(
+const TokenStream = XObject.define(
 
     /**
      * @constructor
@@ -113,14 +113,15 @@ TokenStream = XObject.define(
             while (true) {
                // print(i);
                 if (i < 0) {
-                    if (n < 0) {
-                        return  new Token("", "VOID", "END_OF_STREAM");
+                    if (n > -1) {
+                        i = 0; 
+                        count++;
+                        continue;
+                        
                     }
-                    
-                }
-                else if (i > this.tokens.length)  {
-                    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.cursor && (this.tokens[i] === undefined || this.tokens[i].is("WHIT") || this.tokens[i].is("COMM"))) {
                     if (n < 0) i--; else i++;
@@ -140,6 +141,7 @@ TokenStream = XObject.define(
 
         /**
          *  @return {Token|null}
+         * next token (with white space)
          */
             
            
@@ -215,6 +217,7 @@ TokenStream = XObject.define(
                 }
                 if (!this.next()) break;
             }
+            return false;
         },
 
         getMatchingToken : function(/**String*/start, /**String*/stop) {
@@ -238,6 +241,7 @@ TokenStream = XObject.define(
                 }
                 cursor++;
             }
+            return false;
         },
 
         insertAhead : function(/**JSDOC.Token*/token) {
@@ -276,4 +280,4 @@ TokenStream = XObject.define(
             print(out);
         }
 });
-    
\ No newline at end of file
+