| Crates.io | giron |
| lib.rs | giron |
| version | 0.1.2 |
| created_at | 2020-02-29 07:40:45.498193+00 |
| updated_at | 2020-02-29 08:40:00.431815+00 |
| description | ECMAScript parser which outputs ESTree JSON. |
| homepage | https://github.com/BlueBlazin/giron |
| repository | https://github.com/BlueBlazin/giron |
| max_upload_size | |
| id | 213742 |
| size | 2,607,347 |
v0.1.1
Giron is an ECMAScript parser written in Rust which outputs Rust strucs or JSON in the ESTree specification format.
The giron-wasm provides the compiled .wasm binary and javascript interface for using the giron parser on the web.
Note: giron is a work in progress.
This repository is looking for contributors. There's still a lot of work to be done, but some of the priorities right now are:
Get from crates.io: https://crates.io/crates/giron
Once you add giron to your Cargo.toml,
Basic Usage:
use giron::{parse_module, parse_script};
fn main() {
let source = String::from("const PI = 3.14;");
parse_script(source).unwrap();
}
Giron Errors:
use giron::{parse_module, parse_script, GironError, EstreeNode};
fn analyze_ast() -> Result<EstreeNode, GironError> {
let source = String::from("const PI = 3.14;");
parse_script(source)
}
Parse contents of a javascript file:
use giron::{parse_module, parse_script};
use std::fs;
fn main() {
let source = fs::read_to_string("example-file.js").unwrap();
parse_script(source).unwrap();
}