Stream.peekLine()

This commit is contained in:
2025-08-07 18:18:25 -05:00
parent 6085697914
commit 62c8396ea5

View File

@@ -90,6 +90,14 @@ class Stream {
return Some(content.substr(0, chars)); return Some(content.substr(0, chars));
} }
// Peek until the end of the line or EOF
public function peekLine():Option<String> {
if(content.length == 0) return None;
var index = content.indexOf("\n");
if(index == -1) return Some(content);
return Some(content.substr(0, index));
}
public function isEmpty() { public function isEmpty() {
return content.length == 0; return content.length == 0;
} }