Merge branch 'main' of https://github.com/plexx-dev/Nassi-Shneiderman-Diagramm-Generator into main
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
from typing import Dict, List, Match, Tuple, Union
|
from typing import Dict, List, Match, Tuple, Union
|
||||||
|
|
||||||
from errors.custom import InterpreterException, JavaSyntaxError, ScopeNotFoundException
|
from errors.custom import InterpreterException, JavaSyntaxError, ScopeNotFoundException
|
||||||
@@ -122,6 +121,10 @@ class JavaInterpreter:
|
|||||||
return 2
|
return 2
|
||||||
raise ScopeNotFoundException("Unable to find scope start. Is the program ill-formed?")
|
raise ScopeNotFoundException("Unable to find scope start. Is the program ill-formed?")
|
||||||
|
|
||||||
|
def _get_subscope(self, idx: int):
|
||||||
|
brace_offset = self._get_scope_start_offset(idx)
|
||||||
|
return self._get_instructions_in_scope(idx+brace_offset)
|
||||||
|
|
||||||
def _handle_while(self, line: str, idx: int):
|
def _handle_while(self, line: str, idx: int):
|
||||||
bracket_idx = line.rindex(')') # throws if while contruct is illformed
|
bracket_idx = line.rindex(')') # throws if while contruct is illformed
|
||||||
|
|
||||||
@@ -129,10 +132,6 @@ class JavaInterpreter:
|
|||||||
child_instructions, idx = self._get_subscope(idx)
|
child_instructions, idx = self._get_subscope(idx)
|
||||||
return while_instruction_front(("while" + instruction_txt), child_instructions), idx
|
return while_instruction_front(("while" + instruction_txt), child_instructions), idx
|
||||||
|
|
||||||
def _get_subscope(self, idx: int):
|
|
||||||
brace_offset = self._get_scope_start_offset(idx)
|
|
||||||
return self._get_instructions_in_scope(idx+brace_offset)
|
|
||||||
|
|
||||||
def _get_else_scope(self, idx:int):
|
def _get_else_scope(self, idx:int):
|
||||||
instructions = None
|
instructions = None
|
||||||
if self._check_line_start(idx, "}else"):
|
if self._check_line_start(idx, "}else"):
|
||||||
|
|||||||
Reference in New Issue
Block a user