started implementing support for for loops
This commit is contained in:
@@ -162,3 +162,6 @@ class while_instruction_back(while_instruction_front):
|
||||
res += '\t' +str(inst) + ";\n"
|
||||
res += f"{'}'}while({self.instruction_text});"
|
||||
return res
|
||||
|
||||
class for_instruction(while_instruction_front):
|
||||
pass
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user