pub struct SimpleParserDatabase { /* private fields */ }Expand description
A salsa database for parsing only.
Implementations§
Source§impl SimpleParserDatabase
impl SimpleParserDatabase
Sourcepub fn parse_virtual(
&self,
content: impl ToString,
) -> Result<SyntaxNode<'_>, Diagnostics<'_, ParserDiagnostic<'_>>>
pub fn parse_virtual( &self, content: impl ToString, ) -> Result<SyntaxNode<'_>, Diagnostics<'_, ParserDiagnostic<'_>>>
Parses new file and returns its syntax root.
This is similar to Self::parse_virtual_with_diagnostics, but is more ergonomic in cases when exact diagnostics do not matter at the usage place. If the parser has emitted error diagnostics, this function will return an error. If no error diagnostics has been emitted, the syntax root will be returned.
Sourcepub fn parse_virtual_with_diagnostics(
&self,
content: impl ToString,
) -> (SyntaxNode<'_>, Diagnostics<'_, ParserDiagnostic<'_>>)
pub fn parse_virtual_with_diagnostics( &self, content: impl ToString, ) -> (SyntaxNode<'_>, Diagnostics<'_, ParserDiagnostic<'_>>)
Parses new file and return its syntax root with diagnostics.
This function creates new virtual file with the given content and parses it. Diagnostics gathered by the parser are returned alongside the result.
Sourcepub fn parse_token_stream(
&self,
token_stream: &dyn ToPrimitiveTokenStream<Iter = impl Iterator<Item = PrimitiveToken>>,
) -> (SyntaxNode<'_>, Diagnostics<'_, ParserDiagnostic<'_>>)
pub fn parse_token_stream( &self, token_stream: &dyn ToPrimitiveTokenStream<Iter = impl Iterator<Item = PrimitiveToken>>, ) -> (SyntaxNode<'_>, Diagnostics<'_, ParserDiagnostic<'_>>)
Parses a token stream (based on whole file) and returns its syntax root. It’s very similar to Self::parse_virtual_with_diagnostics, but instead of taking a content as a string, it takes a type that implements ToPrimitiveTokenStream trait
Sourcepub fn parse_token_stream_expr(
&self,
token_stream: &dyn ToPrimitiveTokenStream<Iter = impl Iterator<Item = PrimitiveToken>>,
) -> (SyntaxNode<'_>, Diagnostics<'_, ParserDiagnostic<'_>>)
pub fn parse_token_stream_expr( &self, token_stream: &dyn ToPrimitiveTokenStream<Iter = impl Iterator<Item = PrimitiveToken>>, ) -> (SyntaxNode<'_>, Diagnostics<'_, ParserDiagnostic<'_>>)
Parses a token stream (based on a single expression). It’s very similar to the Self::parse_token_stream.
Trait Implementations§
Source§impl Clone for SimpleParserDatabase
impl Clone for SimpleParserDatabase
Source§fn clone(&self) -> SimpleParserDatabase
fn clone(&self) -> SimpleParserDatabase
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Database for SimpleParserDatabase
impl Database for SimpleParserDatabase
Source§fn trigger_lru_eviction(&mut self)
fn trigger_lru_eviction(&mut self)
Source§fn synthetic_write(&mut self, durability: Durability)
fn synthetic_write(&mut self, durability: Durability)
durability has changed, triggering a new revision.
This is mostly useful for profiling scenarios. Read moreSource§fn trigger_cancellation(&mut self)
fn trigger_cancellation(&mut self)
Source§fn report_untracked_read(&self)
fn report_untracked_read(&self)
Source§fn ingredient_debug_name(
&self,
ingredient_index: IngredientIndex,
) -> Cow<'_, str>
fn ingredient_debug_name( &self, ingredient_index: IngredientIndex, ) -> Cow<'_, str>
Source§fn unwind_if_revision_cancelled(&self)
fn unwind_if_revision_cancelled(&self)
Source§impl Default for SimpleParserDatabase
impl Default for SimpleParserDatabase
Auto Trait Implementations§
impl !Freeze for SimpleParserDatabase
impl RefUnwindSafe for SimpleParserDatabase
impl Send for SimpleParserDatabase
impl !Sync for SimpleParserDatabase
impl Unpin for SimpleParserDatabase
impl !UnwindSafe for SimpleParserDatabase
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
impl<'db, T> DebugDbUpcast<'db, T> for Twhere
T: ?Sized,
fn debug_db_upcast(&'db self) -> &'db T
Source§impl<T> FilesGroup for T
impl<T> FilesGroup for T
Source§fn crate_configs<'db>(
&'db self,
) -> &'db OrderedHashMap<CrateId<'db>, CrateConfiguration<'db>>
fn crate_configs<'db>( &'db self, ) -> &'db OrderedHashMap<CrateId<'db>, CrateConfiguration<'db>>
crate_configs_input.Source§fn file_overrides<'db>(&'db self) -> &'db OrderedHashMap<FileId<'db>, ArcStr>
fn file_overrides<'db>(&'db self) -> &'db OrderedHashMap<FileId<'db>, ArcStr>
file_overrides_input.Source§fn flags<'db>(&'db self) -> &'db OrderedHashMap<FlagId<'db>, Arc<Flag>>
fn flags<'db>(&'db self) -> &'db OrderedHashMap<FlagId<'db>, Arc<Flag>>
flags_input.Source§fn crate_config<'db>(
&'db self,
crate_id: CrateId<'db>,
) -> Option<&'db CrateConfiguration<'db>>
fn crate_config<'db>( &'db self, crate_id: CrateId<'db>, ) -> Option<&'db CrateConfiguration<'db>>
Source§fn file_content<'db>(&'db self, file_id: FileId<'db>) -> Option<&'db str>
fn file_content<'db>(&'db self, file_id: FileId<'db>) -> Option<&'db str>
fn file_summary<'db>( &'db self, file_id: FileId<'db>, ) -> Option<&'db FileSummary>
Source§fn blob_content<'db>(&'db self, blob_id: BlobId<'db>) -> Option<&'db [u8]>
fn blob_content<'db>(&'db self, blob_id: BlobId<'db>) -> Option<&'db [u8]>
Source§fn get_flag<'db>(&'db self, id: FlagId<'db>) -> Option<&'db Flag>
fn get_flag<'db>(&'db self, id: FlagId<'db>) -> Option<&'db Flag>
Source§fn file_input<'db>(&'db self, file_id: FileId<'db>) -> &'db FileInput
fn file_input<'db>(&'db self, file_id: FileId<'db>) -> &'db FileInput
Source§fn crate_input<'db>(&'db self, crt: CrateId<'db>) -> &'db CrateInput
fn crate_input<'db>(&'db self, crt: CrateId<'db>) -> &'db CrateInput
Source§fn set_flag(&mut self, flag: FlagLongId, value: Option<Arc<Flag>>)
fn set_flag(&mut self, flag: FlagLongId, value: Option<Arc<Flag>>)
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more