MCPcopy Index your code
hub / github.com/codeaashu/claude-code / mk

Function mk

src/utils/bash/bashParser.ts:660–675  ·  view source on GitHub ↗

Build a node. Slices text from source by byte range via char-index lookup.

(
  P: ParseState,
  type: string,
  start: number,
  end: number,
  children: TsNode[],
)

Source from the content-addressed store, hash-verified

658
659/** Build a node. Slices text from source by byte range via char-index lookup. */
660function mk(
661 P: ParseState,
662 type: string,
663 start: number,
664 end: number,
665 children: TsNode[],
666): TsNode {
667 checkBudget(P)
668 return {
669 type,
670 text: sliceBytes(P, start, end),
671 startIndex: start,
672 endIndex: end,
673 children,
674 }
675}
676
677function sliceBytes(P: ParseState, startByte: number, endByte: number): string {
678 if (P.isAscii) return P.src.slice(startByte, endByte)

Callers 15

leafFunction · 0.85
parseProgramFunction · 0.85
parseAndOrFunction · 0.85
parsePipelineFunction · 0.85
parseCommandFunction · 0.85
parseSimpleCommandFunction · 0.85
maybeRedirectFunction · 0.85
tryParseAssignmentFunction · 0.85
parseSubscriptIndexFunction · 0.85
tryParseRedirectFunction · 0.85
parseProcessSubFunction · 0.85

Calls 2

checkBudgetFunction · 0.85
sliceBytesFunction · 0.85

Tested by

no test coverage detected