Expand description
A Lua 5.3 parser crate.
To get started:
use luaparse::{parse, HasSpan};
use luaparse::error::Error;
let buf = r#"
local a = 42
local b = 24
for i = 1, 100, 1 do
b = a - b + i
end
print(b)
"#;
match parse(buf) {
Ok(block) => println!("{}", block),
Err(e) => eprintln!("{:#}", Error::new(e.span(), e).with_buffer(buf)),
}
Modules§
Structs§
- Input
Cursor - An input cursor.
- Lexer
- The lexer.
- Lexer
Error - An error returned by the lexer.
- Parser
- The parser.
- Position
- A position in the code.
- Span
- A span, consisting of a starting and an ending position, inclusive.
Enums§
- Lexer
Error Kind - A enum of error kinds returned by the lexer.
- Parse
Error - The error type returned by the parser.
Traits§
- AstDescend
- The trait implemented by non-terminal syntax tree nodes to walk through the children of the node.
- HasSpan
- A trait implemented by types that have a
Span
associated with them. - Visitor
Mut - The trait intended to be implemented by visitors.
Functions§
- parse
- Parses the input as a Lua chunk.