DoxigAlpha

hasComment

Returns true if there exists a line comment between any of the tokens from start_token to end_token. This is used to determine if e.g. a fn_proto should be wrapped and have a trailing comma inserted even if there is none in the source.

Function parameters

Parameters

#
start_token:Ast.TokenIndex
end_token:Ast.TokenIndex

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#

Error sets in this namespace

Error Sets

#

Source

Implementation

#
fn hasComment(tree: Ast, start_token: Ast.TokenIndex, end_token: Ast.TokenIndex) bool {
    for (start_token..end_token) |i| {
        const token: Ast.TokenIndex = @intCast(i);
        const start = tree.tokenStart(token) + tree.tokenSlice(token).len;
        const end = tree.tokenStart(token + 1);
        if (mem.indexOf(u8, tree.source[start..end], "//") != null) return true;
    }

    return false;
}