Skip to main content

ParseCache

Trait ParseCache 

Source
pub trait ParseCache<L>: LexerCache<L>
where L: Language,
{ // Required methods fn arena(&self) -> &SyntaxArena; fn old_tree(&self) -> Option<&GreenNode<'_, L>>; fn lex_output( &self, ) -> Option<&OakDiagnostics<Arc<[Token<<L as Language>::TokenType>]>>>; fn prepare_generation(&mut self); fn commit_generation(&self, root: &GreenNode<'_, L>); }
Expand description

Trait for providing resources and caching for a parsing session.

Required Methods§

Source

fn arena(&self) -> &SyntaxArena

Returns the arena for allocating nodes in the current generation.

Source

fn old_tree(&self) -> Option<&GreenNode<'_, L>>

Returns the root of the previous tree for incremental parsing.

Source

fn lex_output( &self, ) -> Option<&OakDiagnostics<Arc<[Token<<L as Language>::TokenType>]>>>

Returns the output of the lexing phase.

Source

fn prepare_generation(&mut self)

Prepares for a new parsing generation (e.g. by swapping arenas).

Source

fn commit_generation(&self, root: &GreenNode<'_, L>)

Commits the result of a parsing generation.

Implementations on Foreign Types§

Source§

impl<'a, L, C> ParseCache<L> for &'a mut C
where L: Language, C: ParseCache<L> + ?Sized,

Implementors§

Source§

impl<L> ParseCache<L> for ParseSession<L>
where L: Language + Send + Sync + 'static,