Bash grammar for tree-sitter (tree-sitter/tree-sitter-bash v0.25.0), for the MoonBit port of Tree-sitter (moonbit-community/treesitter).
| MoonBit | Rust |
|---|---|
| language() -> @treesitter.Language | LANGUAGE |
| node_types : String | NODE_TYPES (src/node-types.json) |
| highlight_query : String | HIGHLIGHT_QUERY (queries/highlights.scm) |
moon add moonbit-community/tree-sitter-bashimport {
"moonbit-community/treesitter",
"moonbit-community/tree-sitter-bash" @tree_sitter_bash,
}///|
test "parse bash" {
let language = @tree_sitter_bash.language()
let parser = @treesitter.Parser::new()
parser.set_language(language)
let source =
#|whoami
#|
guard parser.parse(@utf8.encode(source)) is Some(tree) else {
fail("parse failed")
}
let root = tree.root_node()
assert_false(root.has_error())
assert_false(root.to_sexp().contains("ERROR"))
}let highlight_query : Stringlet node_types : StringInstall
Download zipBash grammar for tree-sitter (tree-sitter/tree-sitter-bash v0.25.0), for the MoonBit port of Tree-sitter (moonbit-community/treesitter).