diff --git a/parser.y b/parser.y index 4c0b6a2a..bc7bba94 100644 --- a/parser.y +++ b/parser.y @@ -458,7 +458,9 @@ ExpD: ExpD '|' ExpD { $$ = block_join($1, $3); } | - +'-' ExpD { + $$ = BLOCK($2, gen_call("_negate", gen_noop())); +} | Term { $$ = $1; } diff --git a/tests/all.test b/tests/all.test index 259cdf2e..f50b7eb1 100644 --- a/tests/all.test +++ b/tests/all.test @@ -36,6 +36,10 @@ null null [] +{x: -1} +null +{"x": -1} + # The input line starts with a 0xFEFF (byte order mark) codepoint # No, there is no reason to have a byte order mark in UTF8 text. # But apparently people do, so jq shouldn't break on it.