| Crates.io | rslua |
| lib.rs | rslua |
| version | 0.3.0 |
| created_at | 2020-05-30 13:52:29.456684+00 |
| updated_at | 2023-09-10 11:51:19.076376+00 |
| description | Yet another Lua lexer and Lua parser for Lua 5.3 |
| homepage | |
| repository | https://github.com/sssooonnnggg/rslua.git |
| max_upload_size | |
| id | 247680 |
| size | 362,424 |
Yet another Lua lexer and Lua parser for Lua 5.3 written in pure Rust.
use rslua::lexer::Lexer;
let mut lexer = Lexer::new();
let tokens = lexer.run(input_lua_code)?;
| Key | Type | Default | Descripten |
|---|---|---|---|
use_origin_string |
bool | false | Use origin string as token value instead of escaped one. |
reserve_comments |
bool | false | Reserve comments as tokens. |
let mut parser = Parser::new();
let block = parser.run(tokens)?;
Use ast_walker to travel the AST, implement the AstVisitor trait to run custom logic.
Read Lua source files from ./lua folder, parse them, generate ASTs and walk them through, use a LuaWritter struct which impletements the AstVisitor trait to re-generate formatted Lua source again to ./tmp folder.