Makefile grammar for tree-sitter (tree-sitter-grammars/tree-sitter-make v1.1.1), 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) |
| highlights_query : String | HIGHLIGHTS_QUERY (queries/highlights.scm) |
moon add moonbit-community/tree-sitter-makeimport {
"moonbit-community/treesitter",
"moonbit-community/tree-sitter-make" @tree_sitter_make,
}///|
test "parse make" {
let language = @tree_sitter_make.language()
let parser = @treesitter.Parser::new()
parser.set_language(language)
let source =
#|ifeq ("string $(sort 1 2 3)", 'string ${VAR}')
#|endif
#|
#|ifneq (arg0, arg1)
#|endif
#|
#|ifdef var
#|endif
#|
#|ifndef var
#|endif
#|
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 highlights_query : Stringlet node_types : StringInstall
Download zipMakefile grammar for tree-sitter (tree-sitter-grammars/tree-sitter-make v1.1.1), for the MoonBit port of Tree-sitter (moonbit-community/treesitter).