https://github.com/rozbb/nom-lua53
A parser for Lua 5.3 written using the nom parser combinator library
https://github.com/rozbb/nom-lua53
Last synced: 12 months ago
JSON representation
A parser for Lua 5.3 written using the nom parser combinator library
- Host: GitHub
- URL: https://github.com/rozbb/nom-lua53
- Owner: rozbb
- Created: 2017-07-08T19:57:09.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-10T01:55:40.000Z (almost 9 years ago)
- Last Synced: 2025-04-09T21:59:56.290Z (about 1 year ago)
- Language: Rust
- Homepage:
- Size: 68.4 KB
- Stars: 31
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nom-lua53
A toy parser for Lua 5.3 written using nom
# Usage
```rust
extern crate nom_lua53;
use std::io::{self, Read};
use nom_lua53::{parse_all, ParseResult};
fn main() {
let mut input = Vec::new();
io::stdin().read_to_end(&mut input).expect("couldn't read from stdin");
match parse_all(&*input) {
ParseResult::Done(ss) => {
println!("Done. statements == {:#?}", ss);
}
ParseResult::Error(rest, ss) => {
println!("Error. statements == {:#?}", ss);
println!("rest == '{}'", String::from_utf8_lossy(rest));
}
}
}
```