Skip to content

Compile error messages don't provide column only line number #2334

@krichter722

Description

@krichter722

Describe the bug
Compile errors in filter expressions don't include the column number where the parser approximately or exactly locates the error. Most filter expressions are one-liners (are multiple lines even supported?), so the information that the error is on line 1 is not helpful.

Example (I'm not seeking support to make the filter work!):

jq: error: syntax error, unexpected IDENT, expecting $end (Unix shell quoting issues?) at <top-level>, line 1:
..nodes[ ?( @id == 1 ) ]

To Reproduce
Create a query with an erroneus filter expression.

Expected behavior
The error output should provide information where the parser approximately or exactly locates the error in the line, e.g.

jq: error: syntax error, unexpected IDENT, expecting $end (Unix shell quoting issues?) at <top-level>, line 1, column 12:
..nodes[ ?( @id == 1 ) ]

Environment (please complete the following information):

  • OS and Version: Ubuntu 21.04
  • jq version: 1.6

Additional context
./.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions