commit 257bc4164fec78dd2d57c492b0ef876c5b8702da
parent a7a11edd1c765ba96471b032da48d332e0bd5dfb
Author: Eyal Sawady <ecs@d2evs.net>
Date: Tue, 20 Apr 2021 14:11:06 -0400
cmd/harec: buffer the input stream
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cmd/harec/main.ha b/cmd/harec/main.ha
@@ -1,3 +1,4 @@
+use bufio;
use fmt;
use getopt;
use hare::ast;
@@ -44,8 +45,11 @@ export fn main() void = {
cmd.args[i], io::strerror(err)),
};
defer io::close(input);
+ static let buf: [os::BUFSIZ]u8 = [0...];
+ let bufin = bufio::buffered(input, buf, []);
+ defer io::close(bufin);
- let lexer = lex::init(input, cmd.args[i]);
+ let lexer = lex::init(bufin, cmd.args[i]);
let su = match (parse::subunit(&lexer)) {
err: parse::error => {
printerr(err);