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

Function maybeRedirect

src/utils/bash/bashParser.ts:1406–1429  ·  view source on GitHub ↗
(
  P: ParseState,
  node: TsNode,
  allowHerestring = false,
)

Source from the content-addressed store, hash-verified

1404}
1405
1406function maybeRedirect(
1407 P: ParseState,
1408 node: TsNode,
1409 allowHerestring = false,
1410): TsNode {
1411 const redirects: TsNode[] = []
1412 while (true) {
1413 skipBlanks(P.L)
1414 const save = saveLex(P.L)
1415 const r = tryParseRedirect(P)
1416 if (!r) break
1417 if (r.type === 'herestring_redirect' && !allowHerestring) {
1418 restoreLex(P.L, save)
1419 break
1420 }
1421 redirects.push(r)
1422 }
1423 if (redirects.length === 0) return node
1424 const last = redirects[redirects.length - 1]!
1425 return mk(P, 'redirected_statement', node.startIndex, last.endIndex, [
1426 node,
1427 ...redirects,
1428 ])
1429}
1430
1431function tryParseAssignment(P: ParseState): TsNode | null {
1432 const save = saveLex(P.L)

Callers 1

parseCommandFunction · 0.85

Calls 6

skipBlanksFunction · 0.85
saveLexFunction · 0.85
tryParseRedirectFunction · 0.85
restoreLexFunction · 0.85
mkFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected