parseWhitespace function
Implementation
Position? parseWhitespace(String input, int index, int line, int column) {
final char = input[index];
if (char == '\r') {
// CR (Unix)
index++;
line++;
column = 1;
if (input[index] == '\n') {
// CRLF (Windows)
index++;
}
} else if (char == '\n') {
// LF (MacOS)
index++;
line++;
column = 1;
} else if (char == '\t' || char == ' ') {
index++;
column++;
} else {
return null;
}
return new Position(index, line, column);
}