pub enum CstNode {
Leaf {
id: NodeId,
kind: String,
value: String,
},
Constructed {
id: NodeId,
kind: String,
children: Vec<CstNode>,
},
List {
id: NodeId,
kind: String,
ordering: ListOrdering,
children: Vec<CstNode>,
},
}Expand description
A concrete syntax tree node, following the three-kind taxonomy from Zhu & He (OOPSLA 2018) and LASTMERGE (2025).
Variants§
Leaf
Terminal / leaf node — holds the literal text content.
Constructed
Non-terminal with named, fixed-arity children (e.g., if-statement has condition, consequence, alternative).
List
Non-terminal with a variable-length child list (e.g., block of statements, import list). The ordering tag controls matching strategy.
Implementations§
Source§impl CstNode
impl CstNode
pub fn id(&self) -> NodeId
pub fn kind(&self) -> &str
pub fn children(&self) -> &[CstNode]
pub fn children_mut(&mut self) -> &mut Vec<CstNode>
pub fn is_leaf(&self) -> bool
pub fn leaf_value(&self) -> Option<&str>
Sourcepub fn collect_leaves(&self) -> Vec<&str>
pub fn collect_leaves(&self) -> Vec<&str>
Collect all leaf values in pre-order.
Sourcepub fn structurally_equal(&self, other: &CstNode) -> bool
pub fn structurally_equal(&self, other: &CstNode) -> bool
Structural equality (ignores NodeId).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CstNode
impl RefUnwindSafe for CstNode
impl Send for CstNode
impl Sync for CstNode
impl Unpin for CstNode
impl UnwindSafe for CstNode
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
Mutably borrows from an owned value. Read more