12 个稳定版本 (4 个主要)
4.0.0 | 2024 年 7 月 27 日 |
---|---|
3.2.1 |
|
3.2.0 |
|
3.1.1 | 2023 年 5 月 28 日 |
0.0.1 | 2021 年 11 月 28 日 |
#88 in 文本编辑器
每月下载 187 次
用于 2 个 crate(通过 a2kit)
515KB
21K SLoC
Applesoft BASIC 解析器
这是对 tree-sitter-applesoft 的 Rust 绑定。要使用解析器,请在您的包的 Cargo.toml
中包含以下内容
[dependencies]
tree-sitter = "0.22.4"
tree-sitter-applesoft = "4.0.0"
这是一个简单的 main.rs
示例
use tree_sitter;
use tree_sitter_applesoft;
fn main() {
let code = "10 GOTO 10\n";
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_applesoft::language())
.expect("Error loading Applesoft grammar");
let tree = parser.parse(code,None).unwrap();
println!("{}",tree.root_node().to_sexp());
}
这将打印语法树
(source_file (line (linenum) (statement (tok_goto) (linenum))))
有关 Rust 解析的更多信息,请参阅此处的通用指南。
有关此解析器的具体指导,请参阅wiki。
有关使用此库的项目示例,请参阅a2kit。
依赖关系
~2.7–4MB
~71K SLoC