diff --git a/src/orig.py b/src/orig.py index 76034fd..df5f96e 100755 --- a/src/orig.py +++ b/src/orig.py @@ -85,7 +85,12 @@ def write_translated(outfile, origfile, translation_file_paths): # --- Debug --- global debug_current_line debug_current_line += 1 - print("\n-", debug_current_line, transfilepath, tokens[0]) + print( + "\n-", + debug_current_line, + transfilepath, + ''.join(str(x) for x in tokens), + ) # ------------- # Replace the text tokens with the translated ones diff --git a/src/scripter.py b/src/scripter.py index 6c28620..f279ee3 100644 --- a/src/scripter.py +++ b/src/scripter.py @@ -17,7 +17,16 @@ class ScripterToken(): self.type = type def __str__(self): - return f' |{self.token}|' + if self.type == TokenType.TEXT: + color = '\033[34m' + elif self.type == TokenType.COMMAND: + color = '\033[32m' + elif self.type == TokenType.COMMENT: + color = '\033[36m' + return f'{color}{self.token}\033[0m' + + def __repr__(self): + return self.__str__() # Parse and tokenize an Nscripter script line in japanese mode @@ -84,7 +93,8 @@ def is_double_width(char: str) -> bool: ] for start, end in japanese_ranges: - if start <= ord(char[0]) <= end: + #if start <= ord(char[0]) <= end: + if 0xFF < ord(char[0]): return True return False