commit 466964478506739de7084a870c38321c6bd9efee
parent 8b5284b61a18c51f620abf57acdf6af2ac312d0f
Author: Dmitry Matveyev <public@greenfork.me>
Date: Wed, 14 Jun 2023 15:23:00 +0600
bufio: elaborate on docs for scantok and scanline
Signed-off-by: Dmitry Matveyev <public@greenfork.me>
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/bufio/scanner.ha b/bufio/scanner.ha
@@ -266,8 +266,8 @@ export fn scanbyte(file: io::handle) (u8 | io::EOF | io::error) = {
};
};
-// Reads a slice of bytes until the delimiter. Delimiter is not included. The
-// return value must be freed by the caller.
+// Reads a slice of bytes until the delimiter. Delimiter is not included but
+// it is read from the file. The return value must be freed by the caller.
export fn scantok(file: io::handle, delim: u8...) ([]u8 | io::EOF | io::error) = {
let buf: []u8 = [];
@@ -290,7 +290,8 @@ export fn scantok(file: io::handle, delim: u8...) ([]u8 | io::EOF | io::error) =
};
// Reads a slice of bytes until a newline character (\n, 0x0A). Newline itself
-// is not included. The return value must be freed by the caller.
+// is not included but it is read from the file. The return value must be
+// freed by the caller.
export fn scanline(file: io::handle) ([]u8 | io::EOF | io::error) =
scantok(file, '\n');