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

Fix multiple errors spawning for the same token. #265

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

irevoire
Copy link
Contributor

Fix #260

Hey, basically, my error was that when we encountered a trailing error, we were still supposed to recover from it (by eating all the tokens until the end of the line), but I missed it in my first implementation.
So, this PR fixes it and adds a test for it.

…es to avoid throwing duplicated errors for the same character
@sharkdp
Copy link
Owner

sharkdp commented Nov 23, 2023

Thank you very much!

This still has problems in edge cases where expression/statements span multiple lines, but I think that is okay (see below). This PR is definitely an improvement.

>>> if 2 < 3 +
  then 4
  else 5 +
error: while parsing
  ┌─ <input:12>:1:11
  │  
1 │   if 2 < 3 +
  │ ╭──────────^
2 │ │   then 4
  │ ╰^ Expected one of: number, identifier, parenthesized expression

error: while parsing
  ┌─ <input:12>:2:3
  │
2 │   then 4
  │   ^^^^ Expected one of: number, identifier, parenthesized expression

error: while parsing
  ┌─ <input:12>:3:3
  │
3 │   else 5 +
  │   ^^^^ Expected one of: number, identifier, parenthesized expression

@sharkdp sharkdp merged commit 24e6346 into sharkdp:master Nov 23, 2023
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

Successfully merging this pull request may close these issues.

Multiple error message for wrong assignments
2 participants