-
Notifications
You must be signed in to change notification settings - Fork 0
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
Failure in test_traceback: Different column pointer upon parsing error #65
Comments
Why is not pointing to the "|"? It has consumed more whitespace? Maybe we can use the |
Interestingly, with two
|
Yeah, the problem is that it consumes whitespace:
Maybe we can remove all trailing whitespace when reporting errors: move the error indicator to the first not-whitespace character. |
But won't that be fooled by a comment? Arguably the old parser is wrong. Using zero, one, two spaces at the end of the line I get:
It looks like an off-by-one error, trying to point to the end of the line. Also:
The new parser seems to be more rational:
The basic problem here is that the syntax error wants to point at the NEWLINE token -- the The new parser points at the whitespace, which seems correct -- though maybe it could point to the first space or The quickest fix would be to fix the old parser to add 1. |
For some weird reason that I don't really understand, the following fixes the issue by moving the caret one position to the right.
Note that instead of adding one, we need to subtract one, which I find weird. Also, this creates some problems of its own. Since pegen is better here, I'd propose we modify the test to pass with the new parser, skip it when using the old parser and close this issue. |
Careful, looks like you're deleting some code there that deals with non-ASCII source...
|
Sorry, I didn't make myself clear. I only posted this diff to show what's needed to move the caret when using the old parser and to say that that is not really an acceptable solution. Since it is not an acceptable solution, I'm proposing to leave the old parser as is, change the failing test to succeed under the new parser and fail under the old one and then skip it when using the old parser. |
SGTM
|
I opened bpo-40546, since the |
Fixed in python#20072. |
Current Parser:
Pegen:
Difference by one. Would it be okay to just skip this test if pegen is enabled?
The text was updated successfully, but these errors were encountered: