22 releases
0.23.11 | Nov 20, 2024 |
---|---|
0.23.5 | Oct 15, 2024 |
0.22.8 | Jul 26, 2024 |
0.22.2 | Feb 25, 2024 |
0.20.0 | Nov 18, 2023 |
#527 in Text editors
7,038 downloads per month
Used in 10 crates
(7 directly)
11MB
303K
SLoC
tree-sitter-php
PHP grammar for tree-sitter.
lib.rs
:
This crate provides PHP language support for the tree-sitter parsing library.
Typically, you will use the [LANGUAGE_PHP][] constant to add this language to a tree-sitter Parser, and then use the parser to parse some code:
use tree_sitter::Parser;
let code = r#"
<?php
echo "Hello, World!";
?>
"#;
let mut parser = Parser::new();
let language = tree_sitter_php::LANGUAGE_PHP;
parser
.set_language(&language.into())
.expect("Error loading PHP parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());