(self, table, tableIndex, variableDescriptions)
| 167 | self.depth = 0 |
| 168 | self.depth = 0 |
| 169 | def parseChildren(self, table, tableIndex, variableDescriptions): |
| 170 | # Get the initial depth |
| 171 | t0_full = table.cell(0, tableIndex).text |
| 172 | while (t0_full.lstrip("\t").startswith("/*")): |
| 173 | # Ignore comments |
| 174 | tableIndex += 2 |
| 175 | t0_full = table.cell(0, tableIndex).text |
| 176 | self.depth = len(t0_full) - len(t0_full.lstrip("\t")) |
| 177 | |
| 178 | try: |
| 179 | while (True): |
| 180 | t0_full = table.cell(0, tableIndex).text |
| 181 | newDepth = len(t0_full) - len(t0_full.lstrip("\t")) |
| 182 | startsWithComment = t0_full.lstrip("\t").startswith("/*") |
| 183 | if (newDepth < self.depth and not startsWithComment): |
| 184 | # End of container |
| 185 | return tableIndex |
| 186 | if (newDepth > self.depth): |
| 187 | raise SyntaxError(f"The depth of the line is higher then the container depth. Line: {t0_full}") |
| 188 | t0 = t0_full.strip() |
| 189 | t1 = table.cell(0, tableIndex+1).text.strip() |
| 190 | entryType = getEntryType(t0) |
| 191 | |
| 192 | lastEntry = False |
| 193 | try: |
| 194 | t2 = table.cell(0, tableIndex+2).text.strip() |
| 195 | if (t2 == t1): |
| 196 | # Skip identical entries. This may be the aforementioned glitch. |
| 197 | tableIndex += 1 |
| 198 | except IndexError: |
| 199 | # No more data |
| 200 | lastEntry = True |
| 201 | tableIndex += 2 |
| 202 | |
| 203 | if (entryType == "Variable"): |
| 204 | v = Variable(self) |
| 205 | v.fromText(t0, t1, variableDescriptions) |
| 206 | #print(f"{v}") |
| 207 | self.children.append(v) |
| 208 | elif (entryType == "FunctionCall"): |
| 209 | f = FunctionCall(self) |
| 210 | f.fromText(t0) |
| 211 | #print(f"{f}") |
| 212 | self.children.append(f) |
| 213 | elif (entryType == "for"): |
| 214 | f = ContainerFor(self) |
| 215 | f.fromText(t0) |
| 216 | #print(f"{f}") |
| 217 | self.children.append(f) |
| 218 | tableIndex = f.parseChildren(table, tableIndex, variableDescriptions) |
| 219 | elif (entryType == "if"): |
| 220 | i = ContainerIf(self) |
| 221 | i.fromText(t0) |
| 222 | #print(f"{i}") |
| 223 | self.children.append(i) |
| 224 | tableIndex = i.parseChildren(table, tableIndex, variableDescriptions) |
| 225 | elif (entryType == "while"): |
| 226 | w = ContainerWhile(self) |
no test coverage detected