Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First number's type before operator not showing #30

Open
CodeElevator opened this issue Apr 14, 2022 · 4 comments
Open

First number's type before operator not showing #30

CodeElevator opened this issue Apr 14, 2022 · 4 comments

Comments

@CodeElevator
Copy link

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
Copy link
Author

sorry fixed..

@CodeElevator
Copy link
Author

I'm reopening this issue because:
When it shows the type of numbers, parentheses etc.. it doesn't show the FIRST number's type..

@CodeElevator CodeElevator reopened this Apr 14, 2022
@CodeElevator CodeElevator changed the title AttributeError: 'IllegalChar' object has no attribute 'pos_start' First number's type before operator not showing Apr 14, 2022
@BluTen
Copy link

BluTen commented Apr 19, 2022

Code?

@CodeElevator
Copy link
Author

The exact same code @BluTen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants