Skip to main content

PsiBuilder

Struct PsiBuilder 

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

Constructed (from recycled buffers) in pool.rs.

Implementations§

Source§

impl PsiBuilder

Source

pub fn new(text: &str, tokens: &[Token]) -> PsiBuilder

tokens must tile text exactly (lengths sum to text.len()).

Source§

impl PsiBuilder

Source

pub fn get_original_text(&self) -> &str

Source

pub fn get_token_type(&mut self) -> Option<SyntaxKind>

No remapper is ever installed for Kotlin, so the cached-type machinery reduces to this.

Source

pub fn is_whitespace_or_comment(&self, kind: SyntaxKind) -> bool

Whitespace = KtTokens.WHITESPACES, comments = KtTokens.COMMENTS (KotlinParserDefinition); the KDoc sub-builder uses the same Kotlin language definition.

Source

pub fn remap_current_token(&mut self, kind: SyntaxKind)

Source

pub fn look_ahead(&mut self, steps: i32) -> Option<SyntaxKind>

Source

pub fn raw_lookup(&self, steps: i32) -> Option<SyntaxKind>

Source

pub fn raw_token_type_start(&self, steps: i32) -> i32

Source

pub fn raw_token_index(&self) -> i32

Source

pub fn raw_advance_lexer(&mut self, steps: i32)

Source

pub fn advance_lexer(&mut self)

Source

pub fn get_current_offset(&mut self) -> i32

Source

pub fn get_token_text(&mut self) -> Option<&str>

Source

pub fn mark(&mut self) -> Marker

Skips whitespace first unless this is the very first (root) marker.

Source

pub fn eof(&mut self) -> bool

Source

pub fn error(&mut self, message: &str)

Adds an empty error element at the current (possibly pre-whitespace) lexeme; a second error at the same lexeme right after the first is ignored.

Source

pub fn has_errors_after(&self, marker: Marker) -> bool

PsiBuilderImpl.hasErrorsAfter.

Source§

impl PsiBuilder

Source

pub fn get_tree_built(&mut self, lazy: &impl LazyReparse) -> Parse

Source

pub fn build_tree_into( &mut self, root_kind: Option<SyntaxKind>, sink: &mut TreeSink, lazy: &impl LazyReparse, )

getTreeBuilt into a shared sink; the root node gets root_kind if given.

Trait Implementations§

Source§

impl Drop for PsiBuilder

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl MarkerHost for PsiBuilder

Source§

fn psi_builder(&mut self) -> &mut PsiBuilder

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.