LangInner

Struct LangInner 

Source
pub struct LangInner { /* private fields */ }
Expand description

Language implementation with embedded grammar and node types.

Implementations§

Source§

impl LangInner

Source

pub fn new( name: &str, ts_lang: Language, raw_nodes: Vec<RawNode>, grammar: Grammar, ) -> Self

Create a new language from raw node types and grammar.

Source

pub fn node_types(&self) -> &DynamicNodeTypes

Trait Implementations§

Source§

impl Debug for LangInner

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl LangImpl for LangInner

Source§

fn name(&self) -> &str

Source§

fn parse(&self, source: &str) -> Tree

Parse source code into a tree-sitter tree.
Source§

fn resolve_named_node(&self, kind: &str) -> Option<NodeTypeId>

Source§

fn resolve_anonymous_node(&self, kind: &str) -> Option<NodeTypeId>

Source§

fn resolve_field(&self, name: &str) -> Option<NodeFieldId>

Source§

fn all_named_node_kinds(&self) -> Vec<&'static str>

Source§

fn all_field_names(&self) -> Vec<&'static str>

Source§

fn node_type_name(&self, node_type_id: NodeTypeId) -> Option<&'static str>

Source§

fn field_name(&self, field_id: NodeFieldId) -> Option<&'static str>

Source§

fn fields_for_node_type(&self, node_type_id: NodeTypeId) -> Vec<&'static str>

Source§

fn is_supertype(&self, node_type_id: NodeTypeId) -> bool

Source§

fn subtypes(&self, supertype: NodeTypeId) -> &[u16]

Source§

fn root(&self) -> Option<NodeTypeId>

Source§

fn is_extra(&self, node_type_id: NodeTypeId) -> bool

Source§

fn has_field( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, ) -> bool

Source§

fn field_cardinality( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, ) -> Option<Cardinality>

Source§

fn valid_field_types( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, ) -> &[NodeTypeId]

Source§

fn is_valid_field_type( &self, node_type_id: NodeTypeId, node_field_id: NodeFieldId, child: NodeTypeId, ) -> bool

Source§

fn children_cardinality(&self, node_type_id: NodeTypeId) -> Option<Cardinality>

Source§

fn valid_child_types(&self, node_type_id: NodeTypeId) -> &[NodeTypeId]

Source§

fn is_valid_child_type( &self, node_type_id: NodeTypeId, child: NodeTypeId, ) -> bool

Source§

fn grammar(&self) -> &Grammar

Get the grammar for this language (for grammar-verify).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.