JSDOC/TokenReader.vala
[gnome.introspection-doc-generator] / JSDOC / TokenReader.vala
index 7c45861..526b5ed 100644 (file)
@@ -14,7 +14,10 @@ namespace JSDOC {
 
     public class TokenArray: Object {
         
-        Gee.ArrayList<Token> tokens;
+        public Gee.ArrayList<Token> tokens;
+        public int length {
+            get { return this.tokens.size }
+        }
         
         public TokenArray()
         {
@@ -38,6 +41,9 @@ namespace JSDOC {
         public void push (Token t) {
             this.tokens.add(t);
         }
+        public Token get(int i) {
+            return this.tokens.get(i);
+        }
     }
 
 
@@ -102,7 +108,9 @@ namespace JSDOC {
                 if (this.read_word(stream, tokens))      continue;
                 
                 // if execution reaches here then an error has happened
-                tokens.push(new Token(stream.next(), "TOKN", "UNKNOWN_TOKEN", this.line));
+                tokens.push(
+                        new Token(stream.next(), "TOKN", "UNKNOWN_TOKEN", this.line)
+                );
             }
             
             
@@ -119,7 +127,7 @@ namespace JSDOC {
          * @arg {Number} offset where to start reading from
          * @return {Number} position of token
          */
-        findPuncToken : function(tokens, data, n) {
+        public int findPuncToken(TokenArray tokens, string data, int n) {
             n = n || tokens.length -1;
             var stack = 0;
             while (n > -1) {
@@ -133,7 +141,7 @@ namespace JSDOC {
                     n--;
                     continue;
                 }
-                if (stack && (tokens[n].data  == '{' || tokens[n].data  == '(')) {
+                if (stack && (tokens.get(n]).data  == '{' || tokens[n].data  == '(')) {
                     stack--;
                     n--;
                     continue;