Crates.io | ara_parser |
lib.rs | ara_parser |
version | 0.6.6 |
source | src |
created_at | 2022-12-31 10:35:32.176327 |
updated_at | 2023-02-05 22:25:37.580842 |
description | A fault-tolerant, recursive-descent parser for Ara Programming Language 🌲 |
homepage | |
repository | https://github.com/ara-lang/ara |
max_upload_size | |
id | 748361 |
size | 4,230,333 |
Ara
ParserA fault-tolerant, recursive-descent parser for Ara
Programming Language 🌲
Note: This project is a hard-fork of
php-rust-tools/parser
Special thanks to the original authors for their work.
Add ara_parser
to your Cargo.toml
, and you're good to go!
[dependencies]
ara_parser = "0.6.6"
use ara_parser::parser;
use ara_reporting::builder::CharSet;
use ara_reporting::builder::ColorChoice;
use ara_reporting::builder::ReportBuilder;
use ara_reporting::error::Error;
use ara_source::loader::load_directories;
fn main() -> Result<(), Error> {
let source_map = load_directories("/path/to/project", vec!["src/"]).unwrap();
match parser::parse_map(&source_map) {
Ok(tree_map) => tree_map.trees.iter().for_each(|tree| {
println!("{:#?}", tree.definitions);
}),
Err(report) => {
ReportBuilder::new(&source_map)
.with_charset(CharSet::Unicode)
.with_colors(ColorChoice::Always)
.print(report.as_ref())?;
}
}
Ok(())
}
See the documentation for more information.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.