pub struct LinkNetwork { /* private fields */ }Expand description
Mutable links network for CST, AST, semantic, and self-description links.
Implementations§
Source§impl LinkNetwork
impl LinkNetwork
Sourcepub fn self_describing() -> Self
pub fn self_describing() -> Self
Creates a links network containing the common self-description roots.
Sourcepub fn parse(
text: &str,
language: &str,
configuration: ParseConfiguration,
) -> Self
pub fn parse( text: &str, language: &str, configuration: ParseConfiguration, ) -> Self
Parses plain source text into a lossless token network.
This is the default parse operation. It is lossless by construction; use
LinkNetwork::projected_links when a lower-level view should be
stripped away for CST, AST, or semantic-only work.
Sourcepub fn parse_lossless_text(
text: &str,
language: &str,
configuration: ParseConfiguration,
) -> Self
pub fn parse_lossless_text( text: &str, language: &str, configuration: ParseConfiguration, ) -> Self
Parses plain source text into a lossless token network.
This parser boundary preserves source spans, trivia links, recovery markers, and mixed-region metadata behind the same network representation.
Sourcepub fn projected_links(
&self,
projection: NetworkProjection,
) -> impl Iterator<Item = &Link>
pub fn projected_links( &self, projection: NetworkProjection, ) -> impl Iterator<Item = &Link>
Iterates over links included in the selected projection.
Sourcepub fn reconstruct_text(&self) -> String
pub fn reconstruct_text(&self) -> String
Reconstructs source text from non-missing token links ordered by span.
Sourcepub fn embedded_regions(&self) -> Vec<EmbeddedRegion>
pub fn embedded_regions(&self) -> Vec<EmbeddedRegion>
Returns embedded mixed-language regions discovered during parse.
Sourcepub fn query_links(&self, query: &LinkQuery) -> Vec<&Link>
pub fn query_links(&self, query: &LinkQuery) -> Vec<&Link>
Returns links matching a structural query.
Sourcepub fn insert_point(&mut self, term: &str) -> LinkId
pub fn insert_point(&mut self, term: &str) -> LinkId
Inserts a self-referential point link for a term.
Sourcepub fn insert_object(&mut self, term: &str) -> LinkId
pub fn insert_object(&mut self, term: &str) -> LinkId
Inserts an object-identity point link.
Sourcepub fn insert_relation<const N: usize>(
&mut self,
references: [LinkId; N],
link_type: LinkType,
span: SourceSpan,
) -> LinkId
pub fn insert_relation<const N: usize>( &mut self, references: [LinkId; N], link_type: LinkType, span: SourceSpan, ) -> LinkId
Inserts a relation link with source span metadata.
Sourcepub fn insert_field(
&mut self,
parent: LinkId,
label: &str,
child: LinkId,
) -> LinkId
pub fn insert_field( &mut self, parent: LinkId, label: &str, child: LinkId, ) -> LinkId
Inserts a labeled field relation as a regular link.
Sourcepub fn insert_link<const N: usize>(
&mut self,
references: [LinkId; N],
metadata: LinkMetadata,
) -> LinkId
pub fn insert_link<const N: usize>( &mut self, references: [LinkId; N], metadata: LinkMetadata, ) -> LinkId
Inserts a link from references and metadata.
Sourcepub fn insert_concept_mapping(
&mut self,
concept: &str,
language: &str,
syntax: &str,
) -> LinkId
pub fn insert_concept_mapping( &mut self, concept: &str, language: &str, syntax: &str, ) -> LinkId
Inserts a concept-to-language syntax mapping.
Sourcepub fn reconstruct_concept(&self, concept: &str, language: &str) -> Option<&str>
pub fn reconstruct_concept(&self, concept: &str, language: &str) -> Option<&str>
Reconstructs a concept using a target language syntax mapping.
Sourcepub fn apply_substitution(
&mut self,
rule: &SubstitutionRule,
) -> SubstitutionReport
pub fn apply_substitution( &mut self, rule: &SubstitutionRule, ) -> SubstitutionReport
Applies a match-and-substitute rule over exact reference lists.
Sourcepub fn find_term(&self, term: &str) -> Option<LinkId>
pub fn find_term(&self, term: &str) -> Option<LinkId>
Finds a self-description or named term link.
Sourcepub fn definition_for(&self, id: LinkId) -> Option<&str>
pub fn definition_for(&self, id: LinkId) -> Option<&str>
Finds the definition attached to a term link.
Sourcepub fn set_span(&mut self, id: LinkId, span: SourceSpan) -> bool
pub fn set_span(&mut self, id: LinkId, span: SourceSpan) -> bool
Sets a source span on an existing link.
Sourcepub fn set_flags(&mut self, id: LinkId, flags: LinkFlags) -> bool
pub fn set_flags(&mut self, id: LinkId, flags: LinkFlags) -> bool
Sets parse flags on an existing link.
Sourcepub fn verify_full_match(&self, region: Option<ByteRange>) -> VerificationReport
pub fn verify_full_match(&self, region: Option<ByteRange>) -> VerificationReport
Verifies that the selected region has no error or missing links.
Source§impl LinkNetwork
impl LinkNetwork
Trait Implementations§
Source§impl Clone for LinkNetwork
impl Clone for LinkNetwork
Source§fn clone(&self) -> LinkNetwork
fn clone(&self) -> LinkNetwork
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LinkNetwork
impl Debug for LinkNetwork
Source§impl Default for LinkNetwork
impl Default for LinkNetwork
Source§fn default() -> LinkNetwork
fn default() -> LinkNetwork
impl Eq for LinkNetwork
Source§impl PartialEq for LinkNetwork
impl PartialEq for LinkNetwork
Source§fn eq(&self, other: &LinkNetwork) -> bool
fn eq(&self, other: &LinkNetwork) -> bool
self and other values to be equal, and is used by ==.