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 › Ast › fullForComponents Private Function fullForComponents Doc Source Private Function std.zig.Ast.fullForComponents
fn fullForComponents (tree : Ast , info : full .For .Components ) full .For Params File zig/Ast.zig: 2262
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284 fn fullForComponents (tree : Ast , info : full .For .Components ) full .For {
var result : full .For = .{
.ast = info ,
.inline_token = null ,
.label_token = null ,
.payload_token = undefined ,
.else_token = undefined ,
};
var tok_i = info .for_token ;
if (tree .isTokenPrecededByTags (tok_i , &.{.keyword_inline })) {
result .inline_token = tok_i - 1 ;
tok_i = tok_i - 1 ;
}
if (tree .isTokenPrecededByTags (tok_i , &.{ .identifier , .colon })) {
result .label_token = tok_i - 2 ;
}
const last_cond_token = tree .lastToken (info .inputs [info .inputs .len - 1 ]);
result .payload_token = last_cond_token + @as (u32 , 3 ) + @intFromBool (tree .tokenTag (last_cond_token + 1 ) == .comma );
if (info .else_expr != .none ) {
result .else_token = tree .lastToken (info .then_expr ) + 1 ;
}
return result ;
}