read method
Reads character from the top of the stream. Returns A read character or -1 if stream processed to the end.
Implementation
@override
int read() {
// Skip if we are at the end
if ((_position + 1) > _content.length) {
return StringScanner.Eof;
}
// Update the current position
_position++;
if (_position >= _content.length) {
return StringScanner.Eof;
}
// Update line and columns
var charBefore = _charAt(_position - 1);
var charAt = _charAt(_position);
var charAfter = _charAt(_position + 1);
if (_isLine(charBefore, charAt, charAfter)) {
_line++;
_column = 0;
}
if (_isColumn(charAt)) {
_column++;
}
return charAt;
}