MCPcopy Create free account
hub / github.com/IENT/YUView / ContainerFor

Class ContainerFor

tools/standardTextToCode/parseTables.py:366–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364 return f"{spaces}while ({self.condition})"
365
366class ContainerFor(Container):
367 def __init__(self, parent):
368 super().__init__(parent)
369 self.variableName = None
370 self.initialValue = None
371 self.breakCondition = None
372 self.increment = None
373 def fromText(self, text : str):
374 split = text.split(";")
375 if (not split[0].startswith("for")):
376 raise SyntaxError("For container does not start with for")
377
378 firstPart = split[0][split[0].find("(") + 1:]
379 self.variableName = cleanConditionPart(firstPart.split("=")[0])
380 self.initialValue = cleanConditionPart(firstPart.split("=")[1])
381 self.breakCondition = cleanCondition(split[1])
382 self.increment = cleanIncrement(split[2][0:split[2].find(")")])
383 def __str__(self):
384 spaces = ""
385 for _ in range(self.parent.depth):
386 spaces += " "
387 return f"{spaces}for({self.variableName} = {self.initialValue}; {self.breakCondition}; {self.increment})"
388
389def parseDocumentTables(document, variableDescriptions):
390 parsedTables = []

Callers 1

parseChildrenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected