[−][src]Crate luaparse
A Lua 5.3 parser crate.
To get started:
use luaparse::cursor::InputCursor; use luaparse::error::Error; use luaparse::lexer::Lexer; use luaparse::parser::Parser; use luaparse::span::HasSpan; let buf = r#" local a = 42 local b = 24 for i = 1, 100, 1 do b = a - b + i end print(b) "#; let mut parser = Parser::new(Lexer::new(InputCursor::new(buf))); match parser.chunk() { Ok(block) => println!("{}", block), Err(e) => eprintln!("{:#}", Error::new(e.span(), e).with_buffer(buf)), }
Modules
ast | Syntax tree nodes. |
cursor | An input cursor. |
error | Fancy error printing. |
lexer | The Lua lexer. |
parser | The Lua 5.3 parser. |
span | Spans and positions. |
symbol | The symbol tokens. |
token | Tokens. |
visitor | The visitor trait. |