Files
mudblock/lib/core/parser/reader.dart
Chen Asraf 3b2eb1ec9b refactor: variables - remove types
chore: cleanups
chore: formatting
2023-09-30 02:13:50 +03:00

38 lines
540 B
Dart

import 'interfaces.dart';
class StringReader implements IReader<String> {
final String input;
@override
int index = 0;
StringReader(this.input);
@override
int get length => input.length;
@override
bool get isDone => index >= length;
@override
String? peek() {
if (isDone) {
return null;
}
return input[index];
}
@override
String? read() {
if (isDone) {
return null;
}
return input[index++];
}
@override
void setPosition(int position) {
index = position;
}
}