So I don't understand why but when I started to do some errors it gave me that:
Error:
Traceback (most recent call last):
File "c:\Users\..\Desktop\Real\shell.py", line 6, in <module>
if error: print(error.as_string())
File "c:\Users\..\Desktop\Real\basic.py", line 10, in as_string
res += f'File {self.pos_start.fn}, line {self.pos_start.ln + 1}'
AttributeError: 'IllegalChar' object has no attribute 'pos_start'
class Error:
def __init__(self, pos_start, pos_end,error, error_desc):
self.start = pos_start
self.end = pos_end
self.error = error
self.desc = error_desc
def as_string(self):
res = f'{self.error}: {self.desc}'
res += f'File {self.pos_start.fn}, line {self.pos_start.ln + 1}'
return res
class IllegalChar(Error):
def __init__(self, pos_start, pos_end, desc):
super().__init__(pos_start, pos_end, 'Illegal Character', desc)
So I don't understand why but when I started to do some errors it gave me that: Error: