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 › charLiteral Private Function charLiteral Doc Source Private Function std.zig.AstGen.charLiteral
fn charLiteral (gz : *GenZir , ri : ResultInfo , node : Ast .Node .Index ) InnerError !Zir .Inst .Ref Params Errors File zig/AstGen.zig: 8459
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472 fn charLiteral (gz : *GenZir , ri : ResultInfo , node : Ast .Node .Index ) InnerError !Zir .Inst .Ref {
const astgen = gz .astgen ;
const tree = astgen .tree ;
const main_token = tree .nodeMainToken (node );
const slice = tree .tokenSlice (main_token );
switch (std .zig .parseCharLiteral (slice )) {
.success => |codepoint | {
const result = try gz .addInt (codepoint );
return rvalue (gz , ri , result , node );
},
.failure => |err | return astgen .failWithStrLitError (err , main_token , slice , 0 ),
}
}