PHP grammar for tree-sitter (tree-sitter/tree-sitter-php v0.24.2), for the MoonBit port of Tree-sitter (moonbit-community/treesitter).
| MoonBit | Rust |
|---|---|
| language_php() -> @treesitter.Language | LANGUAGE_PHP |
| language_php_only() -> @treesitter.Language | LANGUAGE_PHP_ONLY |
| php_node_types : String | PHP_NODE_TYPES (php/src/node-types.json) |
| php_only_node_types : String | PHP_ONLY_NODE_TYPES (php_only/src/node-types.json) |
| highlights_query : String | HIGHLIGHTS_QUERY (queries/highlights.scm) |
| injections_query : String | INJECTIONS_QUERY (queries/injections.scm) |
| tags_query : String | TAGS_QUERY (queries/tags.scm) |
moon add moonbit-community/tree-sitter-phpimport {
"moonbit-community/treesitter",
"moonbit-community/tree-sitter-php" @tree_sitter_php,
}///|
test "parse php" {
let language = @tree_sitter_php.language_php()
let parser = @treesitter.Parser::new()
parser.set_language(language)
let source =
#|<?php
#|define('self', 'value');
#|var_dump(self);
#|
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 injections_query : Stringlet php_node_types : Stringlet php_only_node_types : Stringlet tags_query : StringInstall
Download zipPHP grammar for tree-sitter (tree-sitter/tree-sitter-php v0.24.2), for the MoonBit port of Tree-sitter (moonbit-community/treesitter).