15 个版本 (5 个重大更新)
0.6.6 | 2023 年 2 月 5 日 |
---|---|
0.6.5 | 2023 年 2 月 4 日 |
0.6.4 | 2023 年 1 月 31 日 |
0.5.3 | 2023 年 1 月 10 日 |
0.1.0 | 2022 年 12 月 31 日 |
在 编程语言 中排名第 187
495KB
13K SLoC
Ara
解析器
针对 Ara
编程语言的容错、递归下降解析器 🌲
注意: 此项目是
php-rust-tools/parser
项目的硬分叉。特别感谢原作者对他们的工作的贡献。
用法
将 ara_parser
添加到您的 Cargo.toml
文件中,然后就可以使用了!
[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(())
}
文档
有关更多信息,请参阅 文档。
许可协议
根据您的选择,许可协议为
- Apache 许可协议 2.0 版(LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT 许可协议(LICENSE-MIT 或 http://opensource.org/licenses/MIT)
。
贡献
除非您明确表示,否则根据 Apache-2.0 许可协议定义,您有意提交的任何贡献,都应按上述方式双重许可,不附加任何额外条款或条件。
鸣谢
依赖项
~1.5–10MB
~87K SLoC