| 197 | |
| 198 | // src/tree.ts |
| 199 | function getText(tree, startIndex, endIndex, startPosition) { |
| 200 | const length = endIndex - startIndex; |
| 201 | let result = tree.textCallback(startIndex, startPosition); |
| 202 | if (result) { |
| 203 | startIndex += result.length; |
| 204 | while (startIndex < endIndex) { |
| 205 | const string = tree.textCallback(startIndex, startPosition); |
| 206 | if (string && string.length > 0) { |
| 207 | startIndex += string.length; |
| 208 | result += string; |
| 209 | } else { |
| 210 | break; |
| 211 | } |
| 212 | } |
| 213 | if (startIndex > endIndex) { |
| 214 | result = result.slice(0, length); |
| 215 | } |
| 216 | } |
| 217 | return result ?? ""; |
| 218 | } |
| 219 | __name(getText, "getText"); |
| 220 | var Tree = class _Tree { |
| 221 | static { |