cclang/src/Interpreter/Utils.py
2020-05-25 20:32:46 +02:00

23 lines
583 B
Python

from termcolor import colored
from Interpreter.Repo import Repo
from Models.Interpreter.Error import Error
class Utils:
def __init__(self, repo: Repo) -> None:
self.__repo = repo
self.line_number: int = 0
def input(self, prefix: str) -> str:
return input(prefix)
def output(self, text: str) -> None:
print(f'-> {text}')
def error(self, error: Error) -> None:
self.__repo.error = error
print(colored(f'Error in line {self.line_number}\n{self.__repo.error.code}: {self.__repo.error.msg}', 'red'))
# exit()