Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Private Function

fnProtoRparen

Private Function
std.zig.Ast.Render.fnProtoRparen
fn fnProtoRparen(tree: Ast, fn_proto: Ast.full.FnProto, maybe_bang: Ast.TokenIndex) Ast.TokenIndex

Params

  • tree: Ast
  • fn_proto: Ast.full.FnProto
  • maybe_bang: Ast.TokenIndex

File

zig/Ast/Render.zig:1698
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
fn fnProtoRparen(tree: Ast, fn_proto: Ast.full.FnProto, maybe_bang: Ast.TokenIndex) Ast.TokenIndex {
    // These may appear in any order, so we have to check the token_starts array
    // to find out which is first.
    var rparen = if (tree.tokenTag(maybe_bang) == .bang) maybe_bang - 1 else maybe_bang;
    var smallest_start = tree.tokenStart(maybe_bang);
    if (fn_proto.ast.align_expr.unwrap()) |align_expr| {
        const tok = tree.firstToken(align_expr) - 3;
        const start = tree.tokenStart(tok);
        if (start < smallest_start) {
            rparen = tok;
            smallest_start = start;
        }
    }
    if (fn_proto.ast.addrspace_expr.unwrap()) |addrspace_expr| {
        const tok = tree.firstToken(addrspace_expr) - 3;
        const start = tree.tokenStart(tok);
        if (start < smallest_start) {
            rparen = tok;
            smallest_start = start;
        }
    }
    if (fn_proto.ast.section_expr.unwrap()) |section_expr| {
        const tok = tree.firstToken(section_expr) - 3;
        const start = tree.tokenStart(tok);
        if (start < smallest_start) {
            rparen = tok;
            smallest_start = start;
        }
    }
    if (fn_proto.ast.callconv_expr.unwrap()) |callconv_expr| {
        const tok = tree.firstToken(callconv_expr) - 3;
        const start = tree.tokenStart(tok);
        if (start < smallest_start) {
            rparen = tok;
            smallest_start = start;
        }
    }
    assert(tree.tokenTag(rparen) == .r_paren);
    return rparen;
}