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.

expect

MacroTranslator.expect
fn expect(mt: *MacroTranslator, expected_id: CToken.Id) ParseError!void

File

lib/compiler/translate-c/MacroTranslator.zig:45

Code

fn expect(mt: *MacroTranslator, expected_id: CToken.Id) ParseError!void {
    const next_id = mt.peek();
    if (next_id != expected_id and !(expected_id == .identifier and next_id == .extended_identifier)) {
        try mt.fail(
            "unable to translate C expr: expected '{s}' instead got '{s}'",
            .{ expected_id.symbol(), next_id.symbol() },
        );
        return error.ParseError;
    }
    mt.i += 1;
}