Zig 0.17.0-dev (Split by item) 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 standard library.
std › zig › AstGen › parseStrLit Private Function parseStrLit Doc Source Private Function std.zig.AstGen.parseStrLit
fn parseStrLit (
astgen : *AstGen ,
token : Ast .TokenIndex ,
buf : *ArrayList (u8 ),
bytes : []const u8 ,
offset : u32 ,
) InnerError !void Params Errors File zig/AstGen.zig: 10762
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781 fn parseStrLit (
astgen : *AstGen ,
token : Ast .TokenIndex ,
buf : *ArrayList (u8 ),
bytes : []const u8 ,
offset : u32 ,
) InnerError !void {
const raw_string = bytes [offset ..];
const result = r : {
var aw : std .Io .Writer .Allocating = .fromArrayList (astgen .gpa , buf );
defer buf .* = aw .toArrayList ();
break :r std .zig .string_literal .parseWrite (&aw .writer , raw_string ) catch |err | switch (err ) {
error .WriteFailed => return error .OutOfMemory ,
};
};
switch (result ) {
.success => return ,
.failure => |err | return astgen .failWithStrLitError (err , token , bytes , offset ),
}
}
Appends the result to
buf.