diff --git a/crates/codegen/parser/runtime/src/cst.rs b/crates/codegen/parser/runtime/src/cst.rs index 4f8833e876..0a3cfbb664 100644 --- a/crates/codegen/parser/runtime/src/cst.rs +++ b/crates/codegen/parser/runtime/src/cst.rs @@ -46,6 +46,7 @@ impl Node { } } + /// Returns a slice of the children (not all descendants) of this node. pub fn children(&self) -> &[Node] { match self { Self::Rule(node) => &node.children, diff --git a/crates/codegen/parser/runtime/src/cursor.rs b/crates/codegen/parser/runtime/src/cursor.rs index 1cb1babecd..a2cdaac93d 100644 --- a/crates/codegen/parser/runtime/src/cursor.rs +++ b/crates/codegen/parser/runtime/src/cursor.rs @@ -144,6 +144,7 @@ impl Cursor { self.current.text_range() } + /// Returns the depth of the current node in the CST, i.e. the number of ancestors. pub fn depth(&self) -> usize { self.path.len() } diff --git a/crates/solidity/outputs/cargo/crate/src/generated/cst.rs b/crates/solidity/outputs/cargo/crate/src/generated/cst.rs index 28b996b98c..77154c22b6 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/cst.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/cst.rs @@ -48,6 +48,7 @@ impl Node { } } + /// Returns a slice of the children (not all descendants) of this node. pub fn children(&self) -> &[Node] { match self { Self::Rule(node) => &node.children, diff --git a/crates/solidity/outputs/cargo/crate/src/generated/cursor.rs b/crates/solidity/outputs/cargo/crate/src/generated/cursor.rs index 6dca60823e..2c265f043c 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/cursor.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/cursor.rs @@ -146,6 +146,7 @@ impl Cursor { self.current.text_range() } + /// Returns the depth of the current node in the CST, i.e. the number of ancestors. pub fn depth(&self) -> usize { self.path.len() } diff --git a/crates/solidity/outputs/npm/crate/src/generated/cst.rs b/crates/solidity/outputs/npm/crate/src/generated/cst.rs index 28b996b98c..77154c22b6 100644 --- a/crates/solidity/outputs/npm/crate/src/generated/cst.rs +++ b/crates/solidity/outputs/npm/crate/src/generated/cst.rs @@ -48,6 +48,7 @@ impl Node { } } + /// Returns a slice of the children (not all descendants) of this node. pub fn children(&self) -> &[Node] { match self { Self::Rule(node) => &node.children, diff --git a/crates/solidity/outputs/npm/crate/src/generated/cursor.rs b/crates/solidity/outputs/npm/crate/src/generated/cursor.rs index 6dca60823e..2c265f043c 100644 --- a/crates/solidity/outputs/npm/crate/src/generated/cursor.rs +++ b/crates/solidity/outputs/npm/crate/src/generated/cursor.rs @@ -146,6 +146,7 @@ impl Cursor { self.current.text_range() } + /// Returns the depth of the current node in the CST, i.e. the number of ancestors. pub fn depth(&self) -> usize { self.path.len() }