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 library itself.
Zig › std/ › zig/ › Ast.zig › fullIfComponents
fullIfComponents
Ast.fullIfComponents
fn fullIfComponents (tree : Ast , info : full .If .Components ) full .If
File
Code
fn fullIfComponents (tree : Ast , info : full .If .Components ) full .If {
var result : full .If = .{
.ast = info ,
.payload_token = null ,
.error_token = null ,
.else_token = undefined ,
};
// ^ ^
const payload_pipe = tree .lastToken (info .cond_expr ) + 2 ;
if (tree .tokenTag (payload_pipe ) == .pipe ) {
result .payload_token = payload_pipe + 1 ;
}
if (info .else_expr != .none ) {
// ^ ^
result .else_token = tree .lastToken (info .then_expr ) + 1 ;
if (tree .tokenTag (result .else_token + 1 ) == .pipe ) {
result .error_token = result .else_token + 2 ;
}
}
return result ;
}