Crates.io | luau-parser |
lib.rs | luau-parser |
version | |
source | src |
created_at | 2025-04-07 16:14:23.000894+00 |
updated_at | 2025-05-22 20:17:30.720616+00 |
description | A blazingly fast Luau parser with robust error recovery. |
homepage | https://github.com/msix29/luau-parser |
repository | https://github.com/msix29/luau-parser |
max_upload_size | |
id | 1624423 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A blazingly fast, lossless, Luau parser, with robust error recovery. Lossless, meaning that none of the details of the code are lost, and that all of it is stored in the returned syntax tree, and thus, the original source code can be printed back by using the Cst::print
function.
This parser has error detection and fills in tokens to account for such circumstances, for example, given:
local function
the produced CST would have tokens that evaluate to:
local function *error*() end
and appropriate errors for these missing tokens are stored to be used by consumers.
use luau_parser::prelude::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 = Parser::new(code);
let cst = parser.parse(uri);
println!("{:#?}", cst);
assert!(!cst.block.is_empty());