diff --git a/draw/Iinstruction.py b/draw/Iinstruction.py index 51d525e..b6f1719 100644 --- a/draw/Iinstruction.py +++ b/draw/Iinstruction.py @@ -161,4 +161,7 @@ class while_instruction_back(while_instruction_front): for inst in self.child_instructions: res += '\t' +str(inst) + ";\n" res += f"{'}'}while({self.instruction_text});" - return res \ No newline at end of file + return res + +class for_instruction(while_instruction_front): + pass \ No newline at end of file diff --git a/interpreter/interpret_source.py b/interpreter/interpret_source.py index e868b7e..40c4140 100644 --- a/interpreter/interpret_source.py +++ b/interpreter/interpret_source.py @@ -166,6 +166,9 @@ class JavaInterpreter: return while_instruction_back(instruction_txt, child_instructions), idx + def _handle_for(self, line: str, idx: int): + return generic_instruction(line), idx + def _handle_variable(self, line: str, idx: int): groups = self._variable_pattern.match(line).groups() var_type = groups[0] @@ -188,6 +191,10 @@ class JavaInterpreter: logging.debug("Found do-while construct in line: %i", idx+1) return self._handle_do_while(line, idx) + elif line.startswith("for("): + logging.debug("Found for construct in line: %i", idx+1) + return self._handle_for(line, idx) + elif self._variable_pattern.match(line): logging.debug("Found variable in line %i", idx+1) return self._handle_variable(line, idx)