aboutsummaryrefslogtreecommitdiff
path: root/src/root.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/root.zig')
-rw-r--r--src/root.zig9
1 files changed, 9 insertions, 0 deletions
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());
}