1import Foundation 2 3public struct Cursor: Sendable { 4 let node: SyntaxTree.Child 5 let utf16Offset: Int 6 let children: [Cursor] 7 8 init(node: SyntaxTree.Child, utf16Offset: Int) { 9 self.node = node 10 self.utf16Offset = utf16Offset 11 12 var children: [Cursor] = [] 13 var utf16Offset = utf16Offset 14 for childNode in node.children { 15 children.append(Self(node: childNode, utf16Offset: utf16Offset)) 16 utf16Offset += childNode.utf16Length 17 } 18 19 self.children = children 20 } 21}