feat(rust): add Language::node_kind_is_supertype

This commit is contained in:
Amaan Qureshi 2024-10-14 17:00:48 -04:00
parent fb23de9261
commit 38e3e51fca
2 changed files with 32 additions and 66 deletions

View file

@ -349,12 +349,19 @@ impl Language {
unsafe { ffi::ts_language_symbol_type(self.0, id) == ffi::TSSymbolTypeRegular }
}
#[doc(alias = "ts_language_symbol_type")]
/// Check if the node type for the given numerical id is visible (as opposed
/// to a hidden node type).
#[must_use]
pub fn node_kind_is_visible(&self, id: u16) -> bool {
unsafe { ffi::ts_language_symbol_type(self.0, id) <= ffi::TSSymbolTypeAnonymous }
}
/// Check if the node type for the given numerical id is a supertype.
#[must_use]
pub fn node_kind_is_supertype(&self, id: u16) -> bool {
unsafe { ffi::ts_language_symbol_type(self.0, id) == ffi::TSSymbolTypeSupertype }
}
/// Get the number of distinct field names in this language.
#[doc(alias = "ts_language_field_count")]
#[must_use]