pub fn loadFileAlloc(filename: []const u8, comptime alignment: usize, allocator: std.mem.Allocator) ![]u8 { var file = try std.fs.cwd().openFile(filename, .{}); defer file.close(); const filesize = (try file.stat()).size + 1; // add null byte const buffer: []align(alignment) u8 = try allocator.alignedAlloc(u8, alignment, filesize); errdefer allocator.free(buffer); try file.reader().readNoEof(buffer[0 .. buffer.len - 1]); buffer[buffer.len - 1] = 0; return buffer; } pub fn checkAndFormatAst(allocator: std.mem.Allocator, input: []const u8) ![]u8 { var ast = try std.zig.Ast.parse(allocator, @as([:0]const u8, @ptrCast(input)), .zig); const out = try ast.render(allocator); return out; } const std = @import("std");