This commit is contained in:
oleting
2020-12-22 21:19:09 +01:00
6 changed files with 7 additions and 5 deletions

2
.vscode/launch.json vendored
View File

@@ -8,7 +8,7 @@
"name": "Python: Aktuelle Datei", "name": "Python: Aktuelle Datei",
"type": "python", "type": "python",
"request": "launch", "request": "launch",
"program": "gui.py", "program": "interpret_source.py",
"console": "integratedTerminal" "console": "integratedTerminal"
} }
] ]

View File

@@ -52,10 +52,10 @@ def get_instructions_in_scope(src: List[str], start_idx: int = 0) -> Tuple[List[
logging.debug("Found if instruction in line: %i", i+1) logging.debug("Found if instruction in line: %i", i+1)
bracket_idx = line.rindex(')') # throws if the contruct is illformed bracket_idx = line.rindex(')') # throws if the contruct is illformed
instruction_txt = line[3:bracket_idx] instruction_txt = line[3:bracket_idx]
true_instructions, i = get_instructions_in_scope(src, i+1) true_instructions, i = get_instructions_in_scope(src, i+2)
false_instructions = None false_instructions = None
if src[i].__contains__("else"): #if there is an else statement, check it if src[i].__contains__("else"): #if there is an else statement, check it
false_instructions, i = get_instructions_in_scope(src, i+1) false_instructions, i = get_instructions_in_scope(src, i+2)
outer_scope.add_instruction(if_instruction(instruction_txt, true_instructions, false_instructions)) outer_scope.add_instruction(if_instruction(instruction_txt, true_instructions, false_instructions))
else: else:

Binary file not shown.

View File

@@ -3,10 +3,12 @@ fahre2();
while(shouldNiet()) { while(shouldNiet()) {
niet4(); niet4();
niet5(); niet5();
if(if6) { if(if6)
{
niet7(); niet7();
niet8(); niet8();
} else { } else
{
niet10(); niet10();
niet11(); niet11();
} }

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB