(sploot_node)
| 418 | ] |
| 419 | |
| 420 | def generateAstStatement(sploot_node): |
| 421 | if sploot_node["type"] == "PYTHON_STATEMENT": |
| 422 | if len(sploot_node['childSets']['statement']) != 0: |
| 423 | return generateAstStatement(sploot_node['childSets']['statement'][0]) |
| 424 | return [ast_comments.Comment("##SPLOOTCODEEMPTYLINE")] |
| 425 | elif sploot_node["type"] == "PYTHON_EXPRESSION": |
| 426 | exp = generateAstExpressionStatement(sploot_node) |
| 427 | return [exp] |
| 428 | elif sploot_node["type"] == "PYTHON_IMPORT": |
| 429 | return generateImportStatement(sploot_node) |
| 430 | elif sploot_node["type"] == "PYTHON_FROM_IMPORT": |
| 431 | return generateFromImportStatement(sploot_node) |
| 432 | elif sploot_node["type"] == "PYTHON_ASSIGNMENT": |
| 433 | return [generateAssignmentStatement(sploot_node)] |
| 434 | elif sploot_node["type"] == "PYTHON_IF_STATEMENT": |
| 435 | return generateIfStatement(sploot_node) |
| 436 | elif sploot_node["type"] == "PYTHON_WHILE_LOOP": |
| 437 | return generateWhileStatement(sploot_node) |
| 438 | elif sploot_node["type"] == "PYTHON_FOR_LOOP": |
| 439 | return generateForStatement(sploot_node) |
| 440 | elif sploot_node["type"] == "PYTHON_FUNCTION_DECLARATION": |
| 441 | return generateFunctionStatement(sploot_node) |
| 442 | elif sploot_node["type"] == "PYTHON_RETURN": |
| 443 | return generateReturnStatement(sploot_node) |
| 444 | elif sploot_node["type"] == "PY_BREAK": |
| 445 | return generateBreakStatement(sploot_node) |
| 446 | elif sploot_node["type"] == "PY_CONTINUE": |
| 447 | return generateContinueStatement(sploot_node) |
| 448 | elif sploot_node["type"] == "PY_COMMENT": |
| 449 | return [ast_comments.Comment('# ' + sploot_node['properties']['value'])] |
| 450 | else: |
| 451 | print("Error: Unrecognised statement type: ", sploot_node["type"]) |
| 452 | return None |
| 453 | |
| 454 | empty_lines = re.compile('^\s*##SPLOOTCODEEMPTYLINE$', flags=re.MULTILINE) |
| 455 |
no test coverage detected