MCPcopy Index your code
hub / github.com/idank/explainshell / visitfor

Method visitfor

explainshell/matcher.py:319–341  ·  view source on GitHub ↗
(self, node, parts)

Source from the content-addressed store, hash-verified

317 self.compound_stack.append("if")
318
319 def visitfor(self, node, parts):
320 self.compound_stack.append("for")
321
322 for part in parts:
323 # don't visit words since they're not part of the current command,
324 # instead consider them part of the for construct
325 if part.kind == "word":
326 mr = MatchResult(
327 part.pos[0],
328 part.pos[1],
329 help_constants._for,
330 None,
331 {"kind": "for_word"},
332 )
333 self.groups[0].results.append(mr)
334
335 # but we do want to visit expansions
336 for p_part in part.parts:
337 self.visit(p_part)
338 else:
339 self.visit(part)
340
341 return False
342
343 def visitwhile(self, *args):
344 self.compound_stack.append("while")

Callers

nothing calls this directly

Calls 1

MatchResultClass · 0.85

Tested by

no test coverage detected