#incremental #parser #applesoft

tree-sitter-applesoft

为 tree-sitter 解析库提供的 Applesoft 语法

12 个稳定版本 (4 个主要)

4.0.0 2024 年 7 月 27 日
3.2.1 2024 年 5 月 12 日
3.2.0 2024 年 4 月 21 日
3.1.1 2023 年 5 月 28 日
0.0.1 2021 年 11 月 28 日

#88 in 文本编辑器

Download history 61/week @ 2024-04-22 86/week @ 2024-05-06 43/week @ 2024-05-13 3/week @ 2024-05-20 1/week @ 2024-05-27 6/week @ 2024-07-01 122/week @ 2024-07-22 49/week @ 2024-07-29 16/week @ 2024-08-05

每月下载 187 次
用于 2 个 crate(通过 a2kit

MIT 许可证

515KB
21K SLoC

C 20K SLoC // 0.0% comments JavaScript 423 SLoC // 0.1% comments Scheme 121 SLoC Rust 33 SLoC // 0.1% comments

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