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

Discrepancy with jq and gojq: subfunction after variable declaration #157

Open
pkoppstein opened this issue Jan 29, 2024 · 1 comment
Open
Milestone

Comments

@pkoppstein
Copy link

Using jaq.jq below:

$ jq -n -f jaq.jq
1
2

$ goq -n -f jaq.jq
1
2

$ jaq -n -f jaq.jq
Error: Unexpected token while parsing definition, expected [, if, try, {, .., -, ., (, "
   ╭─[<unknown>:5:5]
   │
 5 │   | def a: 2 * $s;
   │     ──┬─  
   │       ╰─── Unexpected token def
───╯

jaq.jq

def example:
  . as $s
  | def a: 2 * $s;
  ($s, a);

1 | example
@01mf02
Copy link
Owner

01mf02 commented May 21, 2024

Thanks a lot for reporting this, @pkoppstein! I was not aware that definitions were allowed at such positions. Supporting this will require a breaking change to the syntax, so my plan is to support this for 2.0.

@01mf02 01mf02 added this to the 2.0 milestone May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants