8 unstable releases (3 breaking)
new 0.4.0 | Nov 5, 2024 |
---|---|
0.3.3 | Oct 29, 2024 |
0.2.0 | Oct 24, 2024 |
0.1.1 | Oct 23, 2024 |
#1126 in Parser implementations
717 downloads per month
530KB
14K
SLoC
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);
}
Dependencies
~1MB
~14K SLoC