jq icon indicating copy to clipboard operation
jq copied to clipboard

Compile error messages don't provide column only line number

Open krichter722 opened this issue 3 years ago • 1 comments

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 ./.

krichter722 avatar Jul 09 '21 10:07 krichter722

Same issue:

jq: error: syntax error, unexpected IDENT, expecting $end (Unix shell quoting issues?) at <top-level>, line 1: .60870_enabled

Try to surround by double quote:

example :
'.61850_enabled'
'."61850_enabled"'

DonavanMartin avatar Aug 03 '22 12:08 DonavanMartin