pub struct ProgramRepresentation { /* private fields */ }Expand description
CST-backed resolved program model.
Implementations§
Source§impl ProgramRepresentation
impl ProgramRepresentation
Sourcepub fn query_syntax(&self, term: &str) -> Vec<ProgramRange>
pub fn query_syntax(&self, term: &str) -> Vec<ProgramRange>
Returns exact ranges of CST nodes with the requested grammar term.
Sourcepub fn replace(
&self,
range: ProgramRange,
replacement: &str,
) -> Result<Self, ProgramRepresentationError>
pub fn replace( &self, range: ProgramRange, replacement: &str, ) -> Result<Self, ProgramRepresentationError>
Replaces one exact source range and reparses the result.
Sourcepub fn insert(
&self,
offset: usize,
inserted: &str,
) -> Result<Self, ProgramRepresentationError>
pub fn insert( &self, offset: usize, inserted: &str, ) -> Result<Self, ProgramRepresentationError>
Inserts target-language source at an exact byte boundary.
Sourcepub fn delete(
&self,
range: ProgramRange,
) -> Result<Self, ProgramRepresentationError>
pub fn delete( &self, range: ProgramRange, ) -> Result<Self, ProgramRepresentationError>
Deletes one exact source range.
Sourcepub fn clone_range(
&self,
range: ProgramRange,
destination: usize,
) -> Result<Self, ProgramRepresentationError>
pub fn clone_range( &self, range: ProgramRange, destination: usize, ) -> Result<Self, ProgramRepresentationError>
Clones one exact source range at an exact byte boundary.
Sourcepub fn move_range(
&self,
range: ProgramRange,
destination: usize,
) -> Result<Self, ProgramRepresentationError>
pub fn move_range( &self, range: ProgramRange, destination: usize, ) -> Result<Self, ProgramRepresentationError>
Moves one exact range using byte offsets from the original source.
Sourcepub fn rename_binding(
&self,
binding_id: &str,
replacement: &str,
) -> Result<Self, ProgramRepresentationError>
pub fn rename_binding( &self, binding_id: &str, replacement: &str, ) -> Result<Self, ProgramRepresentationError>
Renames exactly one resolved binding and reparses the edited source.
Source§impl ProgramRepresentation
impl ProgramRepresentation
Sourcepub fn serialize_snapshot(&self) -> String
pub fn serialize_snapshot(&self) -> String
Serializes exact retained token fragments without a duplicate source field.
Sourcepub fn from_snapshot(snapshot: &str) -> Result<Self, ProgramRepresentationError>
pub fn from_snapshot(snapshot: &str) -> Result<Self, ProgramRepresentationError>
Reloads a validated snapshot without access to its original source buffer.
Source§impl ProgramRepresentation
impl ProgramRepresentation
Sourcepub const fn schema_version(&self) -> u32
pub const fn schema_version(&self) -> u32
Schema revision.
Sourcepub const fn project(&self) -> &ProgramProjectContext
pub const fn project(&self) -> &ProgramProjectContext
Project context used during analysis.
Sourcepub const fn network(&self) -> &LinkNetwork
pub const fn network(&self) -> &LinkNetwork
Concrete syntax network enriched by this representation.
Sourcepub fn scopes(&self) -> &[ProgramScope]
pub fn scopes(&self) -> &[ProgramScope]
Lexical scopes inferred from parsed source.
Sourcepub fn bindings(&self) -> &[ProgramBinding]
pub fn bindings(&self) -> &[ProgramBinding]
Local bindings inferred from parsed source.
Sourcepub fn unresolved_references(&self) -> &[ProgramFact]
pub fn unresolved_references(&self) -> &[ProgramFact]
Identifier occurrences without a local declaration.
Sourcepub fn source_mappings(&self) -> &[ProgramSourceMapping]
pub fn source_mappings(&self) -> &[ProgramSourceMapping]
CST source mappings.
Sourcepub fn modules(&self) -> &[ProgramFact]
pub fn modules(&self) -> &[ProgramFact]
Module and import facts.
Sourcepub fn types(&self) -> &[ProgramFact]
pub fn types(&self) -> &[ProgramFact]
Type and universe facts.
Sourcepub fn extensions(&self) -> &[ProgramFact]
pub fn extensions(&self) -> &[ProgramFact]
Attribute, macro, notation, and syntax-extension facts.
Sourcepub fn proofs(&self) -> &[ProgramFact]
pub fn proofs(&self) -> &[ProgramFact]
Proof and tactic facts.
Sourcepub fn diagnostics(&self) -> &[ProgramDiagnostic]
pub fn diagnostics(&self) -> &[ProgramDiagnostic]
Parse diagnostics.
Sourcepub fn project_modules(&self) -> &[ProgramProjectModule]
pub fn project_modules(&self) -> &[ProgramProjectModule]
Project modules the entry program’s requests resolve to.
Sourcepub fn project_facts(&self) -> &[ProgramFact]
pub fn project_facts(&self) -> &[ProgramFact]
Project files and manifests read during analysis.
Sourcepub fn project_references(&self) -> &[ProgramProjectReference]
pub fn project_references(&self) -> &[ProgramProjectReference]
Links from the entry program to declarations in other project files.
Sourcepub fn expansions(&self) -> &[ProgramExpansion]
pub fn expansions(&self) -> &[ProgramExpansion]
Macro, template and notation expansions enabled by the project.
Sourcepub fn constructs(&self) -> &[ProgramConstruct]
pub fn constructs(&self) -> &[ProgramConstruct]
Semantic construct coverage.
Trait Implementations§
Source§impl Clone for ProgramRepresentation
impl Clone for ProgramRepresentation
Source§fn clone(&self) -> ProgramRepresentation
fn clone(&self) -> ProgramRepresentation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ProgramRepresentation
impl RefUnwindSafe for ProgramRepresentation
impl Send for ProgramRepresentation
impl Sync for ProgramRepresentation
impl Unpin for ProgramRepresentation
impl UnsafeUnpin for ProgramRepresentation
impl UnwindSafe for ProgramRepresentation
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<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