16 unstable releases (3 breaking)
0.23.5 | Oct 15, 2024 |
---|---|
0.23.2 | Sep 2, 2024 |
0.22.8 | Jul 26, 2024 |
0.22.2 | Feb 25, 2024 |
0.20.0 | Nov 18, 2023 |
#2812 in Parser implementations
5,594 downloads per month
Used in 7 crates
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());