Struct tree_sitter::Language
source · #[repr(transparent)]pub struct Language(_);
Expand description
An opaque object that defines how to parse a particular language. The code for each
Language
is generated by the Tree-sitter CLI.
Implementations§
source§impl Language
impl Language
sourcepub fn version(&self) -> usize
pub fn version(&self) -> usize
Get the ABI version number that indicates which version of the Tree-sitter CLI
that was used to generate this Language
.
sourcepub fn node_kind_count(&self) -> usize
pub fn node_kind_count(&self) -> usize
Get the number of distinct node types in this language.
sourcepub fn node_kind_for_id(&self, id: u16) -> Option<&'static str>
pub fn node_kind_for_id(&self, id: u16) -> Option<&'static str>
Get the name of the node kind for the given numerical id.
sourcepub fn id_for_node_kind(&self, kind: &str, named: bool) -> u16
pub fn id_for_node_kind(&self, kind: &str, named: bool) -> u16
Get the numeric id for the given node kind.
sourcepub fn node_kind_is_named(&self, id: u16) -> bool
pub fn node_kind_is_named(&self, id: u16) -> bool
Check if the node type for the given numerical id is named (as opposed to an anonymous node type).
pub fn node_kind_is_visible(&self, id: u16) -> bool
sourcepub fn field_count(&self) -> usize
pub fn field_count(&self) -> usize
Get the number of distinct field names in this language.
sourcepub fn field_name_for_id(&self, field_id: u16) -> Option<&'static str>
pub fn field_name_for_id(&self, field_id: u16) -> Option<&'static str>
Get the field names for the given numerical id.