treesitter-types 0.1.2

Generate typed Rust structs from any tree-sitter node-types.json
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Span {
    pub start: tree_sitter::Point,
    pub end: tree_sitter::Point,
    pub start_byte: usize,
    pub end_byte: usize,
}

impl From<tree_sitter::Node<'_>> for Span {
    fn from(node: tree_sitter::Node<'_>) -> Self {
        Self {
            start: node.start_position(),
            end: node.end_position(),
            start_byte: node.start_byte(),
            end_byte: node.end_byte(),
        }
    }
}