MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / parsesWhole

Function parsesWhole

__tests__/pascal-delphi-syntax.test.ts:28–35  ·  view source on GitHub ↗

Whether the unit parses whole: a `unit` node and no error anywhere.

(code: string)

Source from the content-addressed store, hash-verified

26
27/** Whether the unit parses whole: a `unit` node and no error anywhere. */
28function 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. */
38function extract(code: string, file: string): { calls: string[]; names: string[] } {

Callers 1

Calls 4

getParserFunction · 0.90
preParsePascalFunction · 0.90
parseMethod · 0.80
deleteMethod · 0.65

Tested by

no test coverage detected