First number's type before operator not showing
CodeElevator opened this issue · 4 comments
CodeElevator commented
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)
CodeElevator commented
sorry fixed..
CodeElevator commented
I'm reopening this issue because:
When it shows the type of numbers, parentheses etc.. it doesn't show the FIRST number's type..
BluTen commented
Code?
CodeElevator commented
The exact same code @BluTen