SimpleParserDatabase

Struct SimpleParserDatabase 

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

A salsa database for parsing only.

Implementations§

Source§

impl SimpleParserDatabase

Source

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.

Source

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.

Source

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

Source

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

Source§

fn clone(&self) -> SimpleParserDatabase

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Database for SimpleParserDatabase

Source§

fn trigger_lru_eviction(&mut self)

Enforces current LRU limits, evicting entries if necessary. Read more
Source§

fn synthetic_write(&mut self, durability: Durability)

A “synthetic write” causes the system to act as though some input of durability durability has changed, triggering a new revision. This is mostly useful for profiling scenarios. Read more
Source§

fn trigger_cancellation(&mut self)

This method triggers cancellation. If you invoke it while a snapshot exists, it will block until that snapshot is dropped – if that snapshot is owned by the current thread, this could trigger deadlock.
Source§

fn report_untracked_read(&self)

Reports that the query depends on some state unknown to salsa. Read more
Source§

fn ingredient_debug_name( &self, ingredient_index: IngredientIndex, ) -> Cow<'_, str>

Return the “debug name” (i.e., the struct name, etc) for an “ingredient”, which are the fine-grained components we use to track data. This is intended for debugging and the contents of the returned string are not semver-guaranteed. Read more
Source§

fn unwind_if_revision_cancelled(&self)

Starts unwinding the stack if the current revision is cancelled. Read more
Source§

fn attach<R>(&self, op: impl FnOnce(&Self) -> R) -> R
where Self: Sized,

Execute op with the database in thread-local storage for debug print-outs.
Source§

impl Default for SimpleParserDatabase

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl HasStorage for SimpleParserDatabase

Source§

fn storage(&self) -> &Storage<Self>

Source§

fn storage_mut(&mut self) -> &mut Storage<Self>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<'db, T> DebugDbUpcast<'db, T> for T
where T: ?Sized,

Source§

impl<T> FilesGroup for T
where T: Database + ?Sized,

Source§

fn crate_configs<'db>( &'db self, ) -> &'db OrderedHashMap<CrateId<'db>, CrateConfiguration<'db>>

Interned version of crate_configs_input.
Source§

fn file_overrides<'db>(&'db self) -> &'db OrderedHashMap<FileId<'db>, ArcStr>

Interned version of file_overrides_input.
Source§

fn flags<'db>(&'db self) -> &'db OrderedHashMap<FlagId<'db>, Arc<Flag>>

Interned version of flags_input.
Source§

fn crates<'db>(&'db self) -> &'db [CrateId<'db>]

List of crates in the project.
Source§

fn crate_config<'db>( &'db self, crate_id: CrateId<'db>, ) -> Option<&'db CrateConfiguration<'db>>

Configuration of the crate.
Source§

fn file_content<'db>(&'db self, file_id: FileId<'db>) -> Option<&'db str>

Query for the file contents. This takes overrides into consideration.
Source§

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]>

Query for the blob content.
Source§

fn get_flag<'db>(&'db self, id: FlagId<'db>) -> Option<&'db Flag>

Query to get a compilation flag by its ID.
Source§

fn file_input<'db>(&'db self, file_id: FileId<'db>) -> &'db FileInput

Create an input file from an interned file id.
Source§

fn crate_input<'db>(&'db self, crt: CrateId<'db>) -> &'db CrateInput

Create an input crate from an interned crate id.
Source§

fn set_flag(&mut self, flag: FlagLongId, value: Option<Arc<Flag>>)

Sets the given flag value. None value removes the flag.
Source§

fn use_cfg(&mut self, cfg_set: &CfgSet)

Merges specified CfgSet into one already stored in this db.
Source§

fn cfg_set(&self) -> &CfgSet

Returns the cfg set.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ParserGroup for T
where T: Database + ?Sized,

Source§

fn file_syntax<'db>(&'db self, file_id: FileId<'db>) -> Maybe<SyntaxNode<'db>>

Parses a file and returns its AST as a root SyntaxNode.
Source§

fn file_module_syntax<'db>( &'db self, file_id: FileId<'db>, ) -> Maybe<SyntaxFile<'db>>

Parses a file and returns its AST as a root SyntaxFile.
Source§

fn file_expr_syntax<'db>(&'db self, file_id: FileId<'db>) -> Maybe<Expr<'db>>

Parses a file and returns its AST as an expression. Only used for inline macros expanded code.
Source§

fn file_statement_list_syntax<'db>( &'db self, file_id: FileId<'db>, ) -> Maybe<StatementList<'db>>

Parses a file and returns its AST as a list of statements. Only used for inline macros expanded code.
Source§

fn file_syntax_diagnostics<'db>( &'db self, file_id: FileId<'db>, ) -> &'db Diagnostics<'db, ParserDiagnostic<'db>>

Returns the parser diagnostics for this file.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> SyntaxGroup for T
where T: Database + ?Sized,

Source§

fn get_children<'db>(&'db self, node: SyntaxNode<'db>) -> &'db [SyntaxNode<'db>]

Query for caching SyntaxNode::get_children.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more