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

Improve unknown start of token error message for invisible characters #2637

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CramBL
Copy link
Contributor

@CramBL CramBL commented Feb 23, 2025

Resolves #1016

The approach I implemented is displaying the unknown token in single quotes, but if it's not an ASCII character then it is also escaped and displayed in parenthesis.

Invisible character

Before

error: Unknown start of token:
  |
1 | test:
  | ^

After

error: Unknown start of token '' (\u{200b}):
  |
1 | test:
  | ^

ASCII character

Before

error: Unknown start of token:
  |
1 | %test:
  | ^

After

error: Unknown start of token '%':
  |
1 | %test:
  | ^

@CramBL CramBL force-pushed the improve-start-of-token-err-msg branch from b1ab4b2 to 4569d6d Compare February 23, 2025 12:42
@CramBL CramBL force-pushed the improve-start-of-token-err-msg branch from 4569d6d to d99c184 Compare February 23, 2025 12:45
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.

Improve unknown start of token error message for invisible characters
1 participant