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. Public Function

parseRoot

Public Function
std.zig.Parse.parseRoot
pub fn parseRoot(p: *Parse) Allocator.Error!void

Root <- skip ContainerMembers eof

Params

File

zig/Parse.zig:208
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
pub fn parseRoot(p: *Parse) Allocator.Error!void {
    // Root node must be index 0.
    p.nodes.appendAssumeCapacity(.{
        .tag = .root,
        .main_token = 0,
        .data = undefined,
    });
    const root_members = p.parseContainerMembers() catch |err| switch (err) {
        error.OutOfMemory => |e| return e,
        error.ParseError => {
            assert(p.errors.items.len > 0);
            return;
        },
    };
    const root_decls = try root_members.toSpan(p);
    if (p.tokenTag(p.tok_i) != .eof) {
        p.warnExpected(.eof) catch |err| switch (err) {
            error.OutOfMemory => |e| return e,
            error.ParseError => {
                assert(p.errors.items.len > 0);
                return;
            },
        };
    }
    p.nodes.items(.data)[0] = .{ .extra_range = root_decls };
}