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

Parse failure where + reduce(.) is used #9

Closed
marktayl opened this issue Dec 19, 2019 · 1 comment
Closed

Parse failure where + reduce(.) is used #9

marktayl opened this issue Dec 19, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@marktayl
Copy link

Not sure if this has to do with reduce, but jq works with this, whereas gojq can't parse it. FWIW, using a locally defined function def pass: .; instead of the reduce will parse.

# cat x.jq 
. as $rec | foreach . as $c ({};
  $c | . +
  reduce(.) as $k ({}; .) |
  . += {"qq": "baz"} )

# echo '{"foo": "bar"}' | jq -f x.jq 
{
  "foo": "bar",
  "qq": "baz"
}

# echo '{"foo": "bar"}' | ./gojq -f x.jq 
gojq: invalid query: x.jq:2
    2 |   $c | . +
                 ^  unexpected "+" (expected ")")
@marktayl marktayl changed the title Parse failure where Parse failure where + reduce(.) is used Dec 19, 2019
@itchyny
Copy link
Owner

itchyny commented Dec 22, 2019

This issue has been fixed for now.

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

2 participants