11 releases

0.2.0 May 15, 2024
0.1.9 Jan 17, 2021

#7 in #lex

Download history 2/week @ 2024-02-04 4/week @ 2024-02-11 11/week @ 2024-02-25 1/week @ 2024-03-03 7/week @ 2024-03-10 4/week @ 2024-03-17 16/week @ 2024-03-31 1/week @ 2024-04-07 7/week @ 2024-04-21 1/week @ 2024-04-28 167/week @ 2024-05-12 47/week @ 2024-05-19

216 downloads per month
Used in analisar

MIT license

30KB
943 lines

Lex Lua

A Lua lexer written in Rust.

Example

use lex_lua::Lexer;

fn main() {
    let bytes = std::fs::read("./readme.lua").unwrap();
    let l = Lexer::new(bytes.as_slice());
    for (i, token) in l.enumerate() {
        println!("{}: {:?}", i, token);
    }
}
$ cargo run --example readme
0: Keyword(Function)
1: Name("say_hello")
2: Punct(OpenParen)
3: Punct(CloseParen)
4: Name("print")
5: Punct(OpenParen)
6: LiteralString("\'Hi!\'")
7: Punct(CloseParen)
8: Keyword(End)
9: Name("say_hello")
10: Punct(OpenParen)
11: Punct(CloseParen)

Dependencies

~685KB