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

#540 in Text editors

Download history 1684/week @ 2024-09-20 1412/week @ 2024-09-27 1410/week @ 2024-10-04 1338/week @ 2024-10-11 1434/week @ 2024-10-18 1172/week @ 2024-10-25 1377/week @ 2024-11-01 1728/week @ 2024-11-08 1868/week @ 2024-11-15 1471/week @ 2024-11-22 1857/week @ 2024-11-29 1952/week @ 2024-12-06 2954/week @ 2024-12-13 1819/week @ 2024-12-20 1940/week @ 2024-12-27 1820/week @ 2025-01-03

8,802 downloads per month
Used in 12 crates (9 directly)

MIT license

11MB
303K SLoC

C 301K SLoC JavaScript 1.5K SLoC // 0.0% comments Scheme 191 SLoC // 0.0% comments Rust 53 SLoC

tree-sitter-php

CI discord matrix crates npm pypi

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());

Dependencies