luau-parser-0.1.0 has been yanked.
Luau Parser
A lossless parser for the luau programming language, lossless means that none of the details of the code is lost, it's all stored in the returned syntax tree, and thus, the source code can be printed back by using the Cst::print function.
Usage
use Parser;
let code = r#"local foo = "Hello, World!""#;
let uri = ""; // This should be the path of the file being parsed
// (Used for the `cache` feature).
let mut parser = new;
let cst = parser.parse;
println!;
assert!;
Note
- This parser does not stop parsing when it finds an error
- This parser only parses the code into an understandable syntax tree, it does not guarantee that the code itself is error free. Usage of undefined items will not produce wrong results. Statements with syntax errors in them will not be parsed though.
- This parser only works for luau, although for lua versions compatible with luau, it can still be used, for example, lua 5.1, but features limited to a version of lua won't work, for example attributes in lua 5.3.