yshavit / mdq

MIT License
1 stars 0 forks source link

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

Open yshavit opened 1 week ago

yshavit commented 1 week ago

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: