Whether the unit parses whole: a `unit` node and no error anywhere.
(code: string)
| 26 | |
| 27 | /** Whether the unit parses whole: a `unit` node and no error anywhere. */ |
| 28 | function parsesWhole(code: string): boolean { |
| 29 | const tree = getParser('pascal')!.parse(preParsePascal(code))!; |
| 30 | try { |
| 31 | return !tree.rootNode.hasError && tree.rootNode.namedChildren.some((c) => c.type === 'unit'); |
| 32 | } finally { |
| 33 | tree.delete(); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | /** Every routine's calls, as `Caller->Callee`, and every node's qualified name, from the unit's extraction. */ |
| 38 | function extract(code: string, file: string): { calls: string[]; names: string[] } { |
no test coverage detected