// skip all whitespace. Otherwise, we can't skip newlines as these are
// significant.
int next = terminated ? skipWhiteSpace(index) : skipLineSpace(index);
if (next < tokens.size()) {
Token t = tokens.get(next);
for (int i = 0; i != kinds.length; ++i) {
if (t.kind == kinds[i]) {
index = next + 1;
return t;
}