var tokens = new TokenArray();
bool eof;
- while (true) {
+ while (!stream.lookEOF()) {
+
- stream.look(0, out eof)
- if (eof) {
- break;
- }
if (this.read_mlcomment(stream, tokens)) continue;
if (this.read_slcomment(stream, tokens)) continue;
if (this.read_dbquote(stream, tokens)) continue;
return tokens;
- },
+ }
/**
* findPuncToken - find the id of a token (previous to current)
* @arg {Number} offset where to start reading from
* @return {Number} position of token
*/
- public int findPuncToken(TokenArray tokens, string data, int n) {
+ public int findPuncToken(TokenArray tokens, string data, int n)
+ {
n = n || tokens.length -1;
var stack = 0;
while (n > -1) {
return n;
}
- if (tokens[n].data == ')' || tokens[n].data == '}') {
+ if (tokens.get(n).data == ')' || tokens.get(n).data == '}') {
stack++;
n--;
continue;
}
- if (stack && (tokens.get(n).data == '{' || tokens[n].data == '(')) {
+ if (stack && (tokens.get(n).data == '{' || tokens.get(n).data == '(')) {
stack--;
n--;
continue;
n--;
}
return -1;
- },
+ }
/**
* lastSym - find the last token symbol
* need to back check syntax..
* @arg {Number} offset where to start..
* @return {Token} the token
*/
- lastSym : function(tokens, n) {
+ public Token lastSym(TokenArray tokens, int n)
+ {
for (var i = n-1; i >= 0; i--) {
- if (!(tokens[i].is("WHIT") || tokens[i].is("COMM"))) return tokens[i];
+ if (!(tokens.get(i).is("WHIT") || tokens.get(i).is("COMM"))) {
+ return tokens.get(i);
+ }
}
return null;
- },
+ }
/**
@returns {Boolean} Was the token found?
*/
- read_word : function(/**JSDOC.TokenStream*/stream, tokens) {
+ public bool read_word (TokenStream stream, TokenArray tokens) {
var found = "";
- while (!stream.look().eof && Lang.isWordChar(stream.look())) {
+ while (!stream.lookEOF() && Lang.isWordChar(stream.look())) {
found += stream.next();
}
return true;
- },
+ }
/**
@returns {Boolean} Was the token found?