diff --git a/crates/codegen/runtime/cargo/wasm/src/runtime/wrappers/cst/mod.rs b/crates/codegen/runtime/cargo/wasm/src/runtime/wrappers/cst/mod.rs index 2f90e04aef..0e0e6c3639 100644 --- a/crates/codegen/runtime/cargo/wasm/src/runtime/wrappers/cst/mod.rs +++ b/crates/codegen/runtime/cargo/wasm/src/runtime/wrappers/cst/mod.rs @@ -1,11 +1,14 @@ +use std::rc::Rc; + use crate::wasm_crate::utils::{ define_rc_wrapper, define_refcell_wrapper, define_wrapper, enum_to_enum, FromFFI, IntoFFI, }; mod ffi { pub use crate::wasm_crate::bindings::exports::nomic_foundation::slang::cst::{ - AncestorsIterator, Cursor, CursorBorrow, DescendantsIterator, Edge, EdgeLabel, Guest, - GuestCursor, GuestNonterminalNode, GuestQuery, GuestQueryMatchIterator, + AncestorsIterator, AncestorsIteratorBorrow, Cursor, CursorBorrow, DescendantsIterator, + DescendantsIteratorBorrow, Edge, EdgeLabel, Guest, GuestAncestorsIterator, GuestCursor, + GuestDescendantsIterator, GuestNonterminalNode, GuestQuery, GuestQueryMatchIterator, GuestTerminalKindExtensions, GuestTerminalNode, Node, NonterminalKind, NonterminalNode, NonterminalNodeBorrow, Query, QueryBorrow, QueryError, QueryMatch, QueryMatchIterator, QueryMatchIteratorBorrow, TerminalKind, TerminalNode, TerminalNodeBorrow, TextIndex, @@ -117,7 +120,7 @@ define_rc_wrapper! { NonterminalNode { } fn descendants(&self) -> ffi::DescendantsIterator { - self._borrow_ffi().descendants()._into_ffi() + Rc::clone(self._borrow_ffi()).descendants()._into_ffi() } fn unparse(&self) -> String { @@ -157,7 +160,7 @@ define_rc_wrapper! { TerminalNode { } fn descendants(&self) -> ffi::DescendantsIterator { - self._borrow_ffi().descendants()._into_ffi() + Rc::clone(self._borrow_ffi()).descendants()._into_ffi() } fn unparse(&self) -> String { diff --git a/crates/codegen/runtime/npm/package/src/runtime/cst/index.mts b/crates/codegen/runtime/npm/package/src/runtime/cst/index.mts index 227042d491..8056dfacc4 100644 --- a/crates/codegen/runtime/npm/package/src/runtime/cst/index.mts +++ b/crates/codegen/runtime/npm/package/src/runtime/cst/index.mts @@ -28,6 +28,12 @@ export type Edge = generated.cst.Edge; export const Cursor = generated.cst.Cursor; export type Cursor = generated.cst.Cursor; +export const DescendantsIterator = generated.cst.DescendantsIterator; +export type DescendantsIterator = generated.cst.DescendantsIterator; + +export const AncestorsIterator = generated.cst.AncestorsIterator; +export type AncestorsIterator = generated.cst.AncestorsIterator; + export const Query = generated.cst.Query; export type Query = generated.cst.Query; diff --git a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts index 3c9839082c..3a57aad412 100644 --- a/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts +++ b/crates/codegen/runtime/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts @@ -5,6 +5,8 @@ export namespace NomicFoundationSlangCst { export { NonterminalNode }; export { TerminalNode }; export { Cursor }; + export { DescendantsIterator }; + export { AncestorsIterator }; export { Query }; export { QueryMatchIterator }; export { NonterminalKind }; @@ -67,6 +69,11 @@ export interface TextRange { end: TextIndex; } +export class AncestorsIterator { + [Symbol.iterator](): Iterator; + next(): NonterminalNode | undefined; +} + export class Cursor { reset(): void; complete(): void; @@ -78,7 +85,9 @@ export class Cursor { get textOffset(): TextIndex; get textRange(): TextRange; get depth(): number; - get ancestors(): NonterminalNode[]; + children(): Edge[]; + descendants(): DescendantsIterator; + get ancestors(): AncestorsIterator; goToNext(): boolean; goToNextNonDescendant(): boolean; goToPrevious(): boolean; @@ -97,6 +106,11 @@ export class Cursor { query(queries: Query[]): QueryMatchIterator; } +export class DescendantsIterator { + [Symbol.iterator](): Iterator; + next(): Edge | undefined; +} + export class NonterminalNode { readonly nodeVariant = NodeVariant.NonterminalNode; @@ -110,6 +124,7 @@ export class NonterminalNode { get kind(): NonterminalKind; get textLength(): TextIndex; get children(): Edge[]; + descendants(): DescendantsIterator; unparse(): string; toJson(): string; createCursor(textOffset: TextIndex): Cursor; @@ -142,6 +157,7 @@ export class TerminalNode { get kind(): TerminalKind; get textLength(): TextIndex; get children(): Edge[]; + descendants(): DescendantsIterator; unparse(): string; toJson(): string; } diff --git a/crates/metaslang/cst/generated/public_api.txt b/crates/metaslang/cst/generated/public_api.txt index bb549935d3..61de4c1cdf 100644 --- a/crates/metaslang/cst/generated/public_api.txt +++ b/crates/metaslang/cst/generated/public_api.txt @@ -2,13 +2,19 @@ pub mod metaslang_cst pub mod metaslang_cst::cursor +pub struct metaslang_cst::cursor::AncestorsIterator +impl core::iter::traits::iterator::Iterator for metaslang_cst::cursor::AncestorsIterator +pub type metaslang_cst::cursor::AncestorsIterator::Item = alloc::rc::Rc> +pub fn metaslang_cst::cursor::AncestorsIterator::next(&mut self) -> core::option::Option pub struct metaslang_cst::cursor::Cursor impl metaslang_cst::cursor::Cursor pub fn metaslang_cst::cursor::Cursor::query(self, queries: alloc::vec::Vec>) -> metaslang_cst::query::QueryMatchIterator impl metaslang_cst::cursor::Cursor -pub fn metaslang_cst::cursor::Cursor::ancestors(&self) -> impl core::iter::traits::iterator::Iterator>> +pub fn metaslang_cst::cursor::Cursor::ancestors(&self) -> metaslang_cst::cursor::AncestorsIterator +pub fn metaslang_cst::cursor::Cursor::children(&self) -> &[metaslang_cst::nodes::Edge] pub fn metaslang_cst::cursor::Cursor::complete(&mut self) pub fn metaslang_cst::cursor::Cursor::depth(&self) -> usize +pub fn metaslang_cst::cursor::Cursor::descendants(&self) -> metaslang_cst::cursor::DescendantsIterator pub fn metaslang_cst::cursor::Cursor::go_to_first_child(&mut self) -> bool pub fn metaslang_cst::cursor::Cursor::go_to_last_child(&mut self) -> bool pub fn metaslang_cst::cursor::Cursor::go_to_next(&mut self) -> bool @@ -31,8 +37,6 @@ pub fn metaslang_cst::cursor::Cursor::reset(&mut self) pub fn metaslang_cst::cursor::Cursor::spawn(&self) -> Self pub fn metaslang_cst::cursor::Cursor::text_offset(&self) -> metaslang_cst::text_index::TextIndex pub fn metaslang_cst::cursor::Cursor::text_range(&self) -> metaslang_cst::text_index::TextRange -impl metaslang_cst::cursor::Cursor -pub fn metaslang_cst::cursor::Cursor::with_edges(self) -> metaslang_cst::cursor::CursorWithEdges impl core::clone::Clone for metaslang_cst::cursor::Cursor pub fn metaslang_cst::cursor::Cursor::clone(&self) -> metaslang_cst::cursor::Cursor impl core::cmp::Eq for metaslang_cst::cursor::Cursor @@ -40,25 +44,11 @@ impl core::cmp::Parti pub fn metaslang_cst::cursor::Cursor::eq(&self, other: &metaslang_cst::cursor::Cursor) -> bool impl core::fmt::Debug for metaslang_cst::cursor::Cursor pub fn metaslang_cst::cursor::Cursor::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result -impl core::convert::From> for metaslang_cst::cursor::CursorWithEdges -pub fn metaslang_cst::cursor::CursorWithEdges::from(cursor: metaslang_cst::cursor::Cursor) -> Self -impl core::iter::traits::iterator::Iterator for metaslang_cst::cursor::Cursor -pub type metaslang_cst::cursor::Cursor::Item = metaslang_cst::nodes::Node -pub fn metaslang_cst::cursor::Cursor::next(&mut self) -> core::option::Option impl core::marker::StructuralPartialEq for metaslang_cst::cursor::Cursor -pub struct metaslang_cst::cursor::CursorWithEdges -impl metaslang_cst::cursor::CursorWithEdges -pub fn metaslang_cst::cursor::CursorWithEdges::without_edges(self) -> metaslang_cst::cursor::Cursor -impl core::convert::From> for metaslang_cst::cursor::CursorWithEdges -pub fn metaslang_cst::cursor::CursorWithEdges::from(cursor: metaslang_cst::cursor::Cursor) -> Self -impl core::iter::traits::iterator::Iterator for metaslang_cst::cursor::CursorWithEdges -pub type metaslang_cst::cursor::CursorWithEdges::Item = metaslang_cst::nodes::Edge -pub fn metaslang_cst::cursor::CursorWithEdges::next(&mut self) -> core::option::Option -impl core::ops::deref::Deref for metaslang_cst::cursor::CursorWithEdges -pub type metaslang_cst::cursor::CursorWithEdges::Target = metaslang_cst::cursor::Cursor -pub fn metaslang_cst::cursor::CursorWithEdges::deref(&self) -> &Self::Target -impl core::ops::deref::DerefMut for metaslang_cst::cursor::CursorWithEdges -pub fn metaslang_cst::cursor::CursorWithEdges::deref_mut(&mut self) -> &mut Self::Target +pub struct metaslang_cst::cursor::DescendantsIterator +impl core::iter::traits::iterator::Iterator for metaslang_cst::cursor::DescendantsIterator +pub type metaslang_cst::cursor::DescendantsIterator::Item = metaslang_cst::nodes::Edge +pub fn metaslang_cst::cursor::DescendantsIterator::next(&mut self) -> core::option::Option pub mod metaslang_cst::kinds pub trait metaslang_cst::kinds::BaseKind: core::marker::Sized + core::fmt::Debug + core::marker::Copy + core::cmp::PartialEq + core::cmp::Eq + serde::ser::Serialize pub fn metaslang_cst::kinds::BaseKind::as_static_str(&self) -> &'static str @@ -88,7 +78,7 @@ pub fn metaslang_cst::nodes::Node::as_terminal_with_kind(&self, kind: ::as_terminal_with_kinds(&self, kinds: &[::TerminalKind]) -> core::option::Option<&alloc::rc::Rc>> pub fn metaslang_cst::nodes::Node::children(&self) -> &[metaslang_cst::nodes::Edge] pub fn metaslang_cst::nodes::Node::cursor_with_offset(&self, text_offset: metaslang_cst::text_index::TextIndex) -> metaslang_cst::cursor::Cursor -pub fn metaslang_cst::nodes::Node::edges(&self) -> &[metaslang_cst::nodes::Edge] +pub fn metaslang_cst::nodes::Node::descendants(&self) -> metaslang_cst::cursor::DescendantsIterator pub fn metaslang_cst::nodes::Node::id(&self) -> usize pub fn metaslang_cst::nodes::Node::into_nonterminal(self) -> core::option::Option>> pub fn metaslang_cst::nodes::Node::into_terminal(self) -> core::option::Option>> @@ -100,7 +90,6 @@ pub fn metaslang_cst::nodes::Node::is_terminal_with_kind(&self, kind: ::is_terminal_with_kinds(&self, kinds: &[::TerminalKind]) -> bool pub fn metaslang_cst::nodes::Node::is_trivia(&self) -> bool pub fn metaslang_cst::nodes::Node::kind(&self) -> metaslang_cst::nodes::NodeKind -pub fn metaslang_cst::nodes::Node::labeled_edges(&self) -> impl core::iter::traits::iterator::Iterator> pub fn metaslang_cst::nodes::Node::nonterminal(kind: ::NonterminalKind, children: alloc::vec::Vec>) -> Self pub fn metaslang_cst::nodes::Node::terminal(kind: ::TerminalKind, text: alloc::string::String) -> Self pub fn metaslang_cst::nodes::Node::text_len(&self) -> metaslang_cst::text_index::TextIndex @@ -158,7 +147,9 @@ pub metaslang_cst::nodes::NonterminalNode::children: alloc::vec::Vec::NonterminalKind pub metaslang_cst::nodes::NonterminalNode::text_len: metaslang_cst::text_index::TextIndex impl metaslang_cst::nodes::NonterminalNode +pub fn metaslang_cst::nodes::NonterminalNode::children(&self) -> &[metaslang_cst::nodes::Edge] pub fn metaslang_cst::nodes::NonterminalNode::cursor_with_offset(self: alloc::rc::Rc, text_offset: metaslang_cst::text_index::TextIndex) -> metaslang_cst::cursor::Cursor +pub fn metaslang_cst::nodes::NonterminalNode::descendants(self: alloc::rc::Rc) -> metaslang_cst::cursor::DescendantsIterator pub fn metaslang_cst::nodes::NonterminalNode::id(self: &alloc::rc::Rc) -> usize pub fn metaslang_cst::nodes::NonterminalNode::unparse(&self) -> alloc::string::String impl core::clone::Clone for metaslang_cst::nodes::NonterminalNode where ::NonterminalKind: core::clone::Clone @@ -175,6 +166,8 @@ pub struct metaslang_cst::nodes::TerminalNode::TerminalKind pub metaslang_cst::nodes::TerminalNode::text: alloc::string::String impl metaslang_cst::nodes::TerminalNode +pub fn metaslang_cst::nodes::TerminalNode::children(&self) -> &[metaslang_cst::nodes::Edge] +pub fn metaslang_cst::nodes::TerminalNode::descendants(self: alloc::rc::Rc) -> metaslang_cst::cursor::DescendantsIterator pub fn metaslang_cst::nodes::TerminalNode::id(self: &alloc::rc::Rc) -> usize pub fn metaslang_cst::nodes::TerminalNode::unparse(&self) -> alloc::string::String impl core::clone::Clone for metaslang_cst::nodes::TerminalNode where ::TerminalKind: core::clone::Clone diff --git a/crates/solidity/outputs/cargo/crate/generated/public_api.txt b/crates/solidity/outputs/cargo/crate/generated/public_api.txt index 5169e9aab8..589f7bbd7d 100644 --- a/crates/solidity/outputs/cargo/crate/generated/public_api.txt +++ b/crates/solidity/outputs/cargo/crate/generated/public_api.txt @@ -856,8 +856,9 @@ impl serde::ser::Serialize for slang_solidity::cst::TerminalKind pub fn slang_solidity::cst::TerminalKind::serialize<__S>(&self, __serializer: __S) -> core::result::Result<<__S as serde::ser::Serializer>::Ok, <__S as serde::ser::Serializer>::Error> where __S: serde::ser::Serializer impl<'_derivative_strum> core::convert::From<&'_derivative_strum slang_solidity::cst::TerminalKind> for &'static str pub fn &'static str::from(x: &'_derivative_strum slang_solidity::cst::TerminalKind) -> &'static str +pub type slang_solidity::cst::AncestorsIterator = metaslang_cst::cursor::AncestorsIterator pub type slang_solidity::cst::Cursor = metaslang_cst::cursor::Cursor -pub type slang_solidity::cst::CursorWithEdges = metaslang_cst::cursor::CursorWithEdges +pub type slang_solidity::cst::DescendantsIterator = metaslang_cst::cursor::DescendantsIterator pub type slang_solidity::cst::Edge = metaslang_cst::nodes::Edge pub type slang_solidity::cst::Node = metaslang_cst::nodes::Node pub type slang_solidity::cst::NonterminalNode = metaslang_cst::nodes::NonterminalNode diff --git a/crates/solidity/outputs/cargo/wasm/src/generated/wrappers/cst/mod.rs b/crates/solidity/outputs/cargo/wasm/src/generated/wrappers/cst/mod.rs index 6a596cebfc..caa25bcf4a 100644 --- a/crates/solidity/outputs/cargo/wasm/src/generated/wrappers/cst/mod.rs +++ b/crates/solidity/outputs/cargo/wasm/src/generated/wrappers/cst/mod.rs @@ -1,13 +1,16 @@ // This file is generated automatically by infrastructure scripts. Please don't edit by hand. +use std::rc::Rc; + use crate::wasm_crate::utils::{ define_rc_wrapper, define_refcell_wrapper, define_wrapper, enum_to_enum, FromFFI, IntoFFI, }; mod ffi { pub use crate::wasm_crate::bindings::exports::nomic_foundation::slang::cst::{ - AncestorsIterator, Cursor, CursorBorrow, DescendantsIterator, Edge, EdgeLabel, Guest, - GuestCursor, GuestNonterminalNode, GuestQuery, GuestQueryMatchIterator, + AncestorsIterator, AncestorsIteratorBorrow, Cursor, CursorBorrow, DescendantsIterator, + DescendantsIteratorBorrow, Edge, EdgeLabel, Guest, GuestAncestorsIterator, GuestCursor, + GuestDescendantsIterator, GuestNonterminalNode, GuestQuery, GuestQueryMatchIterator, GuestTerminalKindExtensions, GuestTerminalNode, Node, NonterminalKind, NonterminalNode, NonterminalNodeBorrow, Query, QueryBorrow, QueryError, QueryMatch, QueryMatchIterator, QueryMatchIteratorBorrow, TerminalKind, TerminalNode, TerminalNodeBorrow, TextIndex, @@ -119,7 +122,7 @@ define_rc_wrapper! { NonterminalNode { } fn descendants(&self) -> ffi::DescendantsIterator { - self._borrow_ffi().descendants()._into_ffi() + Rc::clone(self._borrow_ffi()).descendants()._into_ffi() } fn unparse(&self) -> String { @@ -159,7 +162,7 @@ define_rc_wrapper! { TerminalNode { } fn descendants(&self) -> ffi::DescendantsIterator { - self._borrow_ffi().descendants()._into_ffi() + Rc::clone(self._borrow_ffi()).descendants()._into_ffi() } fn unparse(&self) -> String { diff --git a/crates/solidity/outputs/npm/package/src/generated/cst/index.mts b/crates/solidity/outputs/npm/package/src/generated/cst/index.mts index 3bab65460e..f3cc921e0b 100644 --- a/crates/solidity/outputs/npm/package/src/generated/cst/index.mts +++ b/crates/solidity/outputs/npm/package/src/generated/cst/index.mts @@ -30,6 +30,12 @@ export type Edge = generated.cst.Edge; export const Cursor = generated.cst.Cursor; export type Cursor = generated.cst.Cursor; +export const DescendantsIterator = generated.cst.DescendantsIterator; +export type DescendantsIterator = generated.cst.DescendantsIterator; + +export const AncestorsIterator = generated.cst.AncestorsIterator; +export type AncestorsIterator = generated.cst.AncestorsIterator; + export const Query = generated.cst.Query; export type Query = generated.cst.Query; diff --git a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts index 79824bc354..795c404f2e 100644 --- a/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts +++ b/crates/solidity/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts @@ -5,6 +5,8 @@ export namespace NomicFoundationSlangCst { export { NonterminalNode }; export { TerminalNode }; export { Cursor }; + export { DescendantsIterator }; + export { AncestorsIterator }; export { Query }; export { QueryMatchIterator }; export { NonterminalKind }; @@ -772,6 +774,11 @@ export interface TextRange { end: TextIndex; } +export class AncestorsIterator { + [Symbol.iterator](): Iterator; + next(): NonterminalNode | undefined; +} + export class Cursor { reset(): void; complete(): void; @@ -783,7 +790,9 @@ export class Cursor { get textOffset(): TextIndex; get textRange(): TextRange; get depth(): number; - get ancestors(): NonterminalNode[]; + children(): Edge[]; + descendants(): DescendantsIterator; + get ancestors(): AncestorsIterator; goToNext(): boolean; goToNextNonDescendant(): boolean; goToPrevious(): boolean; @@ -802,6 +811,11 @@ export class Cursor { query(queries: Query[]): QueryMatchIterator; } +export class DescendantsIterator { + [Symbol.iterator](): Iterator; + next(): Edge | undefined; +} + export class NonterminalNode { readonly nodeVariant = NodeVariant.NonterminalNode; @@ -815,6 +829,7 @@ export class NonterminalNode { get kind(): NonterminalKind; get textLength(): TextIndex; get children(): Edge[]; + descendants(): DescendantsIterator; unparse(): string; toJson(): string; createCursor(textOffset: TextIndex): Cursor; @@ -847,6 +862,7 @@ export class TerminalNode { get kind(): TerminalKind; get textLength(): TextIndex; get children(): Edge[]; + descendants(): DescendantsIterator; unparse(): string; toJson(): string; } diff --git a/crates/testlang/outputs/cargo/wasm/src/generated/wrappers/cst/mod.rs b/crates/testlang/outputs/cargo/wasm/src/generated/wrappers/cst/mod.rs index 6a596cebfc..caa25bcf4a 100644 --- a/crates/testlang/outputs/cargo/wasm/src/generated/wrappers/cst/mod.rs +++ b/crates/testlang/outputs/cargo/wasm/src/generated/wrappers/cst/mod.rs @@ -1,13 +1,16 @@ // This file is generated automatically by infrastructure scripts. Please don't edit by hand. +use std::rc::Rc; + use crate::wasm_crate::utils::{ define_rc_wrapper, define_refcell_wrapper, define_wrapper, enum_to_enum, FromFFI, IntoFFI, }; mod ffi { pub use crate::wasm_crate::bindings::exports::nomic_foundation::slang::cst::{ - AncestorsIterator, Cursor, CursorBorrow, DescendantsIterator, Edge, EdgeLabel, Guest, - GuestCursor, GuestNonterminalNode, GuestQuery, GuestQueryMatchIterator, + AncestorsIterator, AncestorsIteratorBorrow, Cursor, CursorBorrow, DescendantsIterator, + DescendantsIteratorBorrow, Edge, EdgeLabel, Guest, GuestAncestorsIterator, GuestCursor, + GuestDescendantsIterator, GuestNonterminalNode, GuestQuery, GuestQueryMatchIterator, GuestTerminalKindExtensions, GuestTerminalNode, Node, NonterminalKind, NonterminalNode, NonterminalNodeBorrow, Query, QueryBorrow, QueryError, QueryMatch, QueryMatchIterator, QueryMatchIteratorBorrow, TerminalKind, TerminalNode, TerminalNodeBorrow, TextIndex, @@ -119,7 +122,7 @@ define_rc_wrapper! { NonterminalNode { } fn descendants(&self) -> ffi::DescendantsIterator { - self._borrow_ffi().descendants()._into_ffi() + Rc::clone(self._borrow_ffi()).descendants()._into_ffi() } fn unparse(&self) -> String { @@ -159,7 +162,7 @@ define_rc_wrapper! { TerminalNode { } fn descendants(&self) -> ffi::DescendantsIterator { - self._borrow_ffi().descendants()._into_ffi() + Rc::clone(self._borrow_ffi()).descendants()._into_ffi() } fn unparse(&self) -> String { diff --git a/crates/testlang/outputs/npm/package/src/generated/cst/index.mts b/crates/testlang/outputs/npm/package/src/generated/cst/index.mts index 3bab65460e..f3cc921e0b 100644 --- a/crates/testlang/outputs/npm/package/src/generated/cst/index.mts +++ b/crates/testlang/outputs/npm/package/src/generated/cst/index.mts @@ -30,6 +30,12 @@ export type Edge = generated.cst.Edge; export const Cursor = generated.cst.Cursor; export type Cursor = generated.cst.Cursor; +export const DescendantsIterator = generated.cst.DescendantsIterator; +export type DescendantsIterator = generated.cst.DescendantsIterator; + +export const AncestorsIterator = generated.cst.AncestorsIterator; +export type AncestorsIterator = generated.cst.AncestorsIterator; + export const Query = generated.cst.Query; export type Query = generated.cst.Query; diff --git a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts index 7daf286096..fc70756bfc 100644 --- a/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts +++ b/crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts @@ -5,6 +5,8 @@ export namespace NomicFoundationSlangCst { export { NonterminalNode }; export { TerminalNode }; export { Cursor }; + export { DescendantsIterator }; + export { AncestorsIterator }; export { Query }; export { QueryMatchIterator }; export { NonterminalKind }; @@ -95,6 +97,11 @@ export interface TextRange { end: TextIndex; } +export class AncestorsIterator { + [Symbol.iterator](): Iterator; + next(): NonterminalNode | undefined; +} + export class Cursor { reset(): void; complete(): void; @@ -106,7 +113,9 @@ export class Cursor { get textOffset(): TextIndex; get textRange(): TextRange; get depth(): number; - get ancestors(): NonterminalNode[]; + children(): Edge[]; + descendants(): DescendantsIterator; + get ancestors(): AncestorsIterator; goToNext(): boolean; goToNextNonDescendant(): boolean; goToPrevious(): boolean; @@ -125,6 +134,11 @@ export class Cursor { query(queries: Query[]): QueryMatchIterator; } +export class DescendantsIterator { + [Symbol.iterator](): Iterator; + next(): Edge | undefined; +} + export class NonterminalNode { readonly nodeVariant = NodeVariant.NonterminalNode; @@ -138,6 +152,7 @@ export class NonterminalNode { get kind(): NonterminalKind; get textLength(): TextIndex; get children(): Edge[]; + descendants(): DescendantsIterator; unparse(): string; toJson(): string; createCursor(textOffset: TextIndex): Cursor; @@ -170,6 +185,7 @@ export class TerminalNode { get kind(): TerminalKind; get textLength(): TextIndex; get children(): Edge[]; + descendants(): DescendantsIterator; unparse(): string; toJson(): string; }