gobject-ast 0.1.2

AST representation of GObject C code
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use tree_sitter::Node;

use crate::{model::GotoStatement, parser::Parser};

impl Parser {
    pub(crate) fn parse_goto_statement(&self, node: Node, source: &[u8]) -> Option<GotoStatement> {
        let label_node = node.child_by_field_name("label")?;
        let label = std::str::from_utf8(&source[label_node.byte_range()])
            .ok()?
            .to_owned();

        Some(GotoStatement {
            label,
            location: self.node_location(node),
        })
    }
}