| 364 | return f"{spaces}while ({self.condition})" |
| 365 | |
| 366 | class 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 | |
| 389 | def parseDocumentTables(document, variableDescriptions): |
| 390 | parsedTables = [] |