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

Inconsistent diagnostics #32

Merged
merged 2 commits into from
Aug 21, 2024
Merged

Inconsistent diagnostics #32

merged 2 commits into from
Aug 21, 2024

Conversation

aazuspan
Copy link
Owner

Closes #27

Diagnostic positions were reported inconsistently based on newlines
after the error line. This was caused by updating the parser's
previous character every time the parser moved to a new line, rather
than leaving the previous character on the last parsed token. Because
asfv1 doesn't raise errors until it hits a non-whitespace token,
this meant that the previous character would be moved from the token
that caused the error to the whitespace that followed it.

Now, the previous character is only updated once at the beginning of
__next__, meaning that it stays on the last successfully parsed token.

We could use more diagnostic tests overall, but this covers the reported bug.

Diagnostic positions were reported inconsistently based on newlines
after the error line. This was caused by updating the parser's
previous character every time the parser moved to a new line, rather
than leaving the previous character on the last parsed token. Because
asfv1 doesn't raise errors until it hits a non-whitespace token,
this meant that the previous character would be moved from the token
that caused the error to the whitespace that followed it.

Now, the previous character is only updated once at the beginning of
__next__, meaning that it stays on the last successfully parsed token.
@aazuspan aazuspan added the bug Something isn't working label Aug 21, 2024
@aazuspan aazuspan self-assigned this Aug 21, 2024
@aazuspan aazuspan merged commit da2d1fa into main Aug 21, 2024
6 checks passed
@aazuspan aazuspan deleted the inconsistent-diagnostics branch August 21, 2024 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent diagnostic positions
1 participant