-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
[BUG] check_if always overflow #403
Conversation
@jigyasudhingra That is weird. Maybe this is a bug from a wrong merge. My advice is keep your master branch clear to compare with your modified branch. Just discover, it may be a newline inserted by you or your editor on your test file, the error happens when there is no next line. In order to see the tokens, in function parser(), located in simc_parser.py, use this for debug:
The error still persist for
The bug happens with this statement, as you already note:
Or any tokens[i + k]. You can do the check_incomplete function, but use it inside check_if too, that way we ensure check_if is a safe function. |
Yes, it is exactly what is happening whenever I try to run. It accounts newline as well into it because of which 'while' loop (which checks for newline) becomes infinite loop and it throws overflow error. I don't think so, modifications in check_if works for every case because whenever while loop run to find left_brace, it always throw error, so, I have to put something before while loop to check whether tokens are present. I tried this also, but the compiler take account the newline when runs. I will try, what you suggest for checking the tokens. |
@jigyasudhingra I would suggest create a function is_equal(tokens, i, expected) which responsible by comparation that will compare tokens, if out of range throw an error. And do the same check in check_if. I suggest start with the new master, which update and splitted simc_parse into small pieces. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to add review, branch conflict
Trying to fix #361 bug, and it is fixed, showing error " Expected { before if body ":
But, when I ran the program:
Then, again it showing the error which is showing in above case.
So, someone please help me to resolve this.