emmylua_parser

Crates.ioemmylua_parser
lib.rsemmylua_parser
version0.4.0
sourcesrc
created_at2024-10-23 08:54:23.245226
updated_at2024-11-05 03:42:16.493169
descriptionA parser for EmmyLua and luals
homepage
repositoryhttps://github.com/CppCXY/emmylua-analyzer-rust
max_upload_size
id1419847
size526,541
(CppCXY)

documentation

README

EmmyLua-Parser

EmmyLua-Parser is a parser for Lua5.1, Lua5.2, Lua5.3, Lua5.4, and LuaJIT and also supports EmmyLua/LuaCats annotations. Its purpose is to generate AST and CST from the parsed code for further analysis.

Features

  • Lossless syntax tree generation
  • Easy-to-use API based on the rowan library
  • Support for Lua5.1, Lua5.2, Lua5.3, Lua5.4 and LuaJIT
  • Support for EmmyLua/LuaCats annotations
  • Ability to parse code with syntax errors

Usage

let code = r#"
    local a = 1
    local b = 2
    print(a + b)
"#;
let tree = LuaParser::parse(code, ParserConfig::default());

let chunk = tree.get_chunk_node();
for node in chunk.descendants::<LuaAst>() {
    println!("{:?}", node);
}
Commit count: 67

cargo fmt