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.

parseCRelExpr

MacroTranslator.parseCRelExpr
fn parseCRelExpr(mt: *MacroTranslator, scope: *Scope) ParseError!ZigNode

File

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

Code

fn parseCRelExpr(mt: *MacroTranslator, scope: *Scope) ParseError!ZigNode {
    var node = try mt.parseCShiftExpr(scope);
    while (true) {
        switch (mt.peek()) {
            .angle_bracket_right => {
                mt.i += 1;
                const lhs = try mt.macroIntFromBool(node);
                const rhs = try mt.macroIntFromBool(try mt.parseCShiftExpr(scope));
                node = try ZigTag.greater_than.create(mt.t.arena, .{ .lhs = lhs, .rhs = rhs });
            },
            .angle_bracket_right_equal => {
                mt.i += 1;
                const lhs = try mt.macroIntFromBool(node);
                const rhs = try mt.macroIntFromBool(try mt.parseCShiftExpr(scope));
                node = try ZigTag.greater_than_equal.create(mt.t.arena, .{ .lhs = lhs, .rhs = rhs });
            },
            .angle_bracket_left => {
                mt.i += 1;
                const lhs = try mt.macroIntFromBool(node);
                const rhs = try mt.macroIntFromBool(try mt.parseCShiftExpr(scope));
                node = try ZigTag.less_than.create(mt.t.arena, .{ .lhs = lhs, .rhs = rhs });
            },
            .angle_bracket_left_equal => {
                mt.i += 1;
                const lhs = try mt.macroIntFromBool(node);
                const rhs = try mt.macroIntFromBool(try mt.parseCShiftExpr(scope));
                node = try ZigTag.less_than_equal.create(mt.t.arena, .{ .lhs = lhs, .rhs = rhs });
            },
            else => return node,
        }
    }
}