luaur-analysis 0.1.0

Luau type checker and type inference (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use luaur_ast::records::comment::Comment;
use luaur_ast::records::lexeme::Type;
use luaur_ast::records::position::Position;

pub fn contains(pos: Position, comment: Comment) -> bool {
    if comment.location.contains(pos) {
        return true;
    } else if comment.r#type == Type::BrokenComment && comment.location.begin <= pos {
        return true;
    } else if comment.r#type == Type::Comment
        && comment.location.end.line == pos.line
        && comment.location.begin <= pos
    {
        return true;
    } else {
        return false;
    }
}