finishWhitespace method
Implementation
Token finishWhitespace() {
_index--;
while (_index < _text.length) {
final ch = _text.codeUnitAt(_index++);
if (ch == TokenChar.SPACE ||
ch == TokenChar.TAB ||
ch == TokenChar.RETURN) {
// do nothing
} else if (ch == TokenChar.NEWLINE) {
if (!_inString) {
return _finishToken(TokenKind.WHITESPACE); // note the newline?
}
} else {
_index--;
if (_inString) {
return next();
} else {
return _finishToken(TokenKind.WHITESPACE);
}
}
}
return _finishToken(TokenKind.END_OF_FILE);
}