This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.
fncheckAgainstOracle(source: [:0]constu8) !void {
varfba_buf: [1 << 18]u8 = undefined;
varfba: std.heap.FixedBufferAllocator = .init(&fba_buf);
constexpected = tryoracle.parse(source);
// It is important to disable recovery for fuzz testing.
// Consider the case where there is a parse error right at the beginning of the file,
// followed by a valid declaration with a million nested parens. The oracle will not
// skip this input due to the max depth being exceeded since the oracle hits a parse
// error right away and does no recovery. However, std.zig.Ast.parse() does recovery
// by default and will hit a stack overflow rather than returning after the parser error.
// Stack overflows are not interesting and we do not want the fuzzer to be able to find them.
constast = trystd.zig.Ast.parse(fba.allocator(), source, .{ .recover = false });
errdeferlogBadSource(source, ast);
trystd.testing.expectEqual(expected, ast.errors.len == 0);
}