X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=JSDOC%2FTokenReader.vala;h=526b5edfb65708f0eddd888968a13945f2bef65c;hb=12c827ce40e56aa39ab4f19d20a49238397c0f59;hp=ebc19b0da99a02b4467d7d4de362c2cec2be6a00;hpb=c9a7c98c718d1578283b8538b61078b2b93731de;p=gnome.introspection-doc-generator diff --git a/JSDOC/TokenReader.vala b/JSDOC/TokenReader.vala index ebc19b0..526b5ed 100644 --- a/JSDOC/TokenReader.vala +++ b/JSDOC/TokenReader.vala @@ -14,7 +14,10 @@ namespace JSDOC { public class TokenArray: Object { - Gee.ArrayList tokens; + public Gee.ArrayList tokens; + public int length { + get { return this.tokens.size } + } public TokenArray() { @@ -27,7 +30,7 @@ namespace JSDOC { } return null; } - public Token? lastSym = function() { + public Token? lastSym () { for (var i = this.tokens.length-1; i >= 0; i--) { if (!(this.tokens.get(i).is("WHIT") || this.tokens.get(i).is("COMM"))) { return this.tokens.get(i); @@ -35,6 +38,12 @@ namespace JSDOC { } return null; } + public void push (Token t) { + this.tokens.add(t); + } + public Token get(int i) { + return this.tokens.get(i); + } } @@ -99,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) + ); } @@ -116,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) { @@ -130,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;