pub struct ParseSession<L>{ /* private fields */ }Expand description
A memory pool that manages the lifecycle of parsing generations.
ParseSession handles the double-buffering of memory arenas (Active vs Old)
to support efficient incremental reuse. It implements ParseCache.
Implementations§
Source§impl<L> ParseSession<L>
impl<L> ParseSession<L>
Sourcepub fn new(capacity: usize) -> ParseSession<L>
pub fn new(capacity: usize) -> ParseSession<L>
Creates a new parse session.
Trait Implementations§
Source§impl<L> Default for ParseSession<L>
impl<L> Default for ParseSession<L>
Source§fn default() -> ParseSession<L>
fn default() -> ParseSession<L>
Returns the “default value” for a type. Read more
Source§impl<L> LexerCache<L> for ParseSession<L>
impl<L> LexerCache<L> for ParseSession<L>
Source§fn set_lex_output(
&mut self,
output: OakDiagnostics<Arc<[Token<<L as Language>::TokenType>]>>,
)
fn set_lex_output( &mut self, output: OakDiagnostics<Arc<[Token<<L as Language>::TokenType>]>>, )
Sets the lexed output in the cache. Read more
Source§fn get_token(&self, index: usize) -> Option<Token<<L as Language>::TokenType>>
fn get_token(&self, index: usize) -> Option<Token<<L as Language>::TokenType>>
Gets a token from the cache by index. Read more
Source§fn count_tokens(&self) -> usize
fn count_tokens(&self) -> usize
Gets the total number of tokens in the cache. Read more
Source§fn has_tokens(&self) -> bool
fn has_tokens(&self) -> bool
Checks if the cache contains any tokens. Read more
Source§impl<L> ParseCache<L> for ParseSession<L>
impl<L> ParseCache<L> for ParseSession<L>
Source§fn arena(&self) -> &SyntaxArena
fn arena(&self) -> &SyntaxArena
Returns the arena for allocating nodes in the current generation.
Source§fn old_tree(&self) -> Option<&GreenNode<'_, L>>
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>]>>>
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)
fn prepare_generation(&mut self)
Prepares for a new parsing generation (e.g. by swapping arenas).
Source§fn commit_generation(&self, root: &GreenNode<'_, L>)
fn commit_generation(&self, root: &GreenNode<'_, L>)
Commits the result of a parsing generation.
impl<L> BuilderCache<L> for ParseSession<L>
impl<L> Send for ParseSession<L>
impl<L> Sync for ParseSession<L>
Auto Trait Implementations§
impl<L> !Freeze for ParseSession<L>
impl<L> !RefUnwindSafe for ParseSession<L>
impl<L> Unpin for ParseSession<L>
impl<L> !UnwindSafe for ParseSession<L>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more