luaur-analysis 0.1.0

Luau type checker and type inference (Rust).
Documentation
use luaur_ast::enums::mode::Mode;
use luaur_ast::records::hot_comment::HotComment;

pub fn parse_mode(hotcomments: &[HotComment]) -> Option<Mode> {
    for hc in hotcomments {
        if !hc.header {
            continue;
        }

        if hc.content == "nocheck" {
            return Some(Mode::NoCheck);
        }

        if hc.content == "nonstrict" {
            return Some(Mode::Nonstrict);
        }

        if hc.content == "strict" {
            return Some(Mode::Strict);
        }
    }

    None
}