* 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) {
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;
}