luaur-ast 0.1.0

Lexer, parser, and AST for Luau (faithful Rust port).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::records::cst_node::CstNode;
use crate::rtti::CstNodeClass;

impl CstNode {
    #[allow(non_snake_case)]
    pub fn as_item<T: CstNodeClass>(&self) -> *const T {
        if self.class_index == T::CLASS_INDEX {
            self as *const CstNode as *const T
        } else {
            core::ptr::null()
        }
    }
}