From db2f49115713c47b48587022511b3654a7042493 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Sun, 19 Apr 2026 22:28:56 +0200 Subject: feat(lib): support input from file and from reader --- src/root.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/root.zig') diff --git a/src/root.zig b/src/root.zig index 4750814..956f584 100644 --- a/src/root.zig +++ b/src/root.zig @@ -56,6 +56,15 @@ pub fn zigParse(alloc: std.mem.Allocator, content: []const u8) Error![]const u8 return parser.parse(alloc, content); } +pub fn zigParseReader(alloc: std.mem.Allocator, r: *std.io.Reader) ![]const u8 { + return parser.parseReader(alloc, r); +} + +pub fn zigParseFile(alloc: std.mem.Allocator, path: []const u8) ![]const u8 { + const file = try std.fs.cwd().readFileAlloc(alloc, path, std.math.maxInt(usize)); + return zigParse(alloc, file); +} + test { std.testing.refAllDeclsRecursive(@This()); } -- cgit v1.2.3