(parser: Parser)
| 83 | } |
| 84 | |
| 85 | function setParseTimeout(parser: Parser): void { |
| 86 | const maybeSetTimeout = ( |
| 87 | parser as Parser & { setTimeoutMicros?: (timeout: number | bigint) => void } |
| 88 | ).setTimeoutMicros; |
| 89 | if (typeof maybeSetTimeout === 'function') { |
| 90 | try { |
| 91 | maybeSetTimeout.call(parser, TREE_SITTER_PARSE_TIMEOUT_MICROS); |
| 92 | } catch { |
| 93 | try { |
| 94 | maybeSetTimeout.call(parser, Number(TREE_SITTER_PARSE_TIMEOUT_MICROS)); |
| 95 | } catch { |
| 96 | // Ignore timeout wiring failures; parser execution still proceeds. |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | function sliceUtf8(content: string, startIndex: number, endIndex: number): string { |
| 103 | const utf8 = Buffer.from(content, 'utf8'); |
no outgoing calls
no test coverage detected