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

selector syntax errors point to wrong char if at end of input #65

Open
yshavit opened this issue Jun 23, 2024 · 0 comments
Open

selector syntax errors point to wrong char if at end of input #65

yshavit opened this issue Jun 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@yshavit
Copy link
Owner

yshavit commented Jun 23, 2024

Example 1: Unexpected end of input:

$ cat example.md | mdq '- ['

Syntax error in select specifier:
┃ - [
┃   ↑ unexpected end of input

The arrow should point to the position after the [:

┃ - [
┃    ↑ unexpected end of input

Example 2: Unexpected end of input when we expect a specific char:

$ cat example.md | mdq '- [x'

Syntax error in select specifier:
┃ - [x
┃    ↑ expected "]"

Again, the arrow should point at the missing char:

┃ - [x 
┃     ↑ expected "]"

Additional notes:

  • The above examples are different error reason: one is UnexpectedEndOfInput, the other is Expected(']'). That means I can't just match my way out of this; I'll need to actually think about what's going on. :-)
  • While I'm fixing this, I should see if there's a better approach to the err.position.column - 1 hack in main.rs where I print the syntax error.
  • This was introduced/discovered in various parser improvements #64, but it's not important enough for me to block that PR on this bug.
@yshavit yshavit added the bug Something isn't working label Jun 23, 2024
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

No branches or pull requests

1 participant