26 releases (9 breaking)

new 0.10.6 May 20, 2025
0.10.4 Apr 18, 2025
0.10.2 Mar 21, 2025
0.7.0 Dec 12, 2024
0.5.0 Nov 12, 2024

#413 in Parser implementations

Download history 305/week @ 2025-02-03 284/week @ 2025-02-10 243/week @ 2025-02-17 171/week @ 2025-02-24 182/week @ 2025-03-03 69/week @ 2025-03-10 164/week @ 2025-03-17 70/week @ 2025-03-24 168/week @ 2025-03-31 95/week @ 2025-04-07 203/week @ 2025-04-14 68/week @ 2025-04-21 40/week @ 2025-04-28 186/week @ 2025-05-05 118/week @ 2025-05-12

435 downloads per month
Used in 4 crates

MIT license

610KB
16K 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.

Internationalization (i18n) Support

This crate supports multiple languages, defaulting to English (en-US). Users can optionally initialize i18n to set a different language.

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

~7–16MB
~211K SLoC