3 unstable releases

0.2.0 Jun 14, 2020
0.1.1 Jun 5, 2020
0.1.0 May 30, 2020

#1721 in Text processing

Download history 4/week @ 2024-02-19 26/week @ 2024-02-26 3/week @ 2024-03-04 4/week @ 2024-03-11 1/week @ 2024-03-18 60/week @ 2024-04-01

66 downloads per month
Used in misc-conf

Apache-2.0

150KB
4K SLoC

luaparse

A Lua 5.3 parser. Preserves insignificant tokens (whitespace and comments) in the syntax tree.

Documentation.

Example

use luaparse::error::Error;
use luaparse::{parse, HasSpan};

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)),
}

lib.rs:

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)),
}

Dependencies

~2–10MB
~95K SLoC