tree-sitter-htmlx 0.1.10

Tree-sitter grammar for HTMLX (expression-enhanced HTML)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Shared test utilities for tree-sitter-htmlx tests

use tree_sitter_htmlx::LANGUAGE;

/// Parse an HTMLX source string and return the S-expression representation
pub fn parse(source: &str) -> String {
    let mut parser = tree_sitter::Parser::new();
    parser
        .set_language(&LANGUAGE.into())
        .expect("Failed to load HTMLX grammar");

    let tree = parser.parse(source, None).expect("Failed to parse");
    tree.root_node().to_sexp()
}