pub struct AnyParsedStatement<'a> { /* private fields */ }Expand description
Grammar-erased view of a parsed statement.
Cheap to borrow — holds a raw parser pointer, source reference, and grammar
handle. Nodes and lists store &'a AnyParsedStatement<'a> rather than an
owned copy, making them Copy and eliminating grammar-handle clones.
Implementations§
Source§impl<'a> AnyParsedStatement<'a>
impl<'a> AnyParsedStatement<'a>
Sourcepub fn root_id(&self) -> AnyNodeId
pub fn root_id(&self) -> AnyNodeId
Root node ID for the current statement (AnyNodeId::NULL if absent).
Sourcepub fn macro_regions(&self) -> impl Iterator<Item = MacroRegion> + use<'_>
pub fn macro_regions(&self) -> impl Iterator<Item = MacroRegion> + use<'_>
Macro expansion call-site spans recorded during parsing.
Sourcepub fn token_spans(&self) -> impl Iterator<Item = (u32, u32)> + use<'_>
pub fn token_spans(&self) -> impl Iterator<Item = (u32, u32)> + use<'_>
Raw token spans (offset, length) for all collected tokens.
Returns an empty iterator if collect_tokens was not enabled.
Always non-empty when the result comes from TypedParser::incremental_parse,
which unconditionally enables token collection.
Sourcepub fn comment_spans(&self) -> impl Iterator<Item = CommentSpan> + use<'_>
pub fn comment_spans(&self) -> impl Iterator<Item = CommentSpan> + use<'_>
Lightweight comment descriptors without source text borrows.
Returns an empty iterator if collect_tokens was not enabled.
Sourcepub fn extract_fields(
&self,
id: AnyNodeId,
) -> Option<(AnyNodeTag, NodeFields<'a>)>
pub fn extract_fields( &self, id: AnyNodeId, ) -> Option<(AnyNodeTag, NodeFields<'a>)>
Extract reflective node data (tag + field values) for id.
Sourcepub fn list_children(&self, id: AnyNodeId) -> Option<&'a [AnyNodeId]>
pub fn list_children(&self, id: AnyNodeId) -> Option<&'a [AnyNodeId]>
Return child node IDs if id is a list node.
Sourcepub fn child_node_ids(
&self,
id: AnyNodeId,
) -> impl Iterator<Item = AnyNodeId> + '_
pub fn child_node_ids( &self, id: AnyNodeId, ) -> impl Iterator<Item = AnyNodeId> + '_
Iterate direct child node IDs for the node at id.
Trait Implementations§
Source§impl<'a> Clone for AnyParsedStatement<'a>
impl<'a> Clone for AnyParsedStatement<'a>
Source§fn clone(&self) -> AnyParsedStatement<'a>
fn clone(&self) -> AnyParsedStatement<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more