minor fixes on main file

This commit is contained in:
Luna 2020-04-01 16:10:47 -03:00
parent 5ae47fb962
commit a623d9b2ca

View file

@ -19,11 +19,10 @@ pub fn run(allocator: *std.mem.Allocator, slice: []const u8) !Result {
// do a full scan pass, then reset, then do it again (with parser) // do a full scan pass, then reset, then do it again (with parser)
while (true) { while (true) {
var tok_opt = scan.nextToken() catch |err| { var tok_opt = scan.nextToken() catch |err| {
std.debug.warn( std.debug.warn("error at '{}': {}\n", .{
"error at '{}': {}\n",
scan.currentLexeme(), scan.currentLexeme(),
err, err,
); });
return Result.TokenizeError; return Result.TokenizeError;
}; };
@ -76,7 +75,7 @@ pub fn main() anyerror!void {
const filepath = try (args_it.next(allocator) orelse @panic("expected file path")); const filepath = try (args_it.next(allocator) orelse @panic("expected file path"));
var file = try std.fs.File.openRead(filepath); var file = try std.fs.cwd().openFile(filepath, .{});
defer file.close(); defer file.close();
const total_bytes = try file.getEndPos(); const total_bytes = try file.getEndPos();