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

foreach not supported? #162

Open
oguz-ismail opened this issue Feb 27, 2024 · 4 comments
Open

foreach not supported? #162

oguz-ismail opened this issue Feb 27, 2024 · 4 comments

Comments

@oguz-ismail
Copy link

See:

oguz@LAPTOP-KKDLALF8:~$ jaq -n 'foreach . as $x (.; .; .)'
Error: Unexpected token while parsing string, expected =, [, and, <=, //, %=, -, %, +, /=, *=, ,, or, *, >=, |=, !=, ==, ", >, ?, |, +=, /, as, <, ), -=
   ╭─[<unknown>:1:22]
   │
 1 │ foreach . as $x (.; .; .)
   │                      ─┬
   │                       ╰── Unexpected token ;
───╯
oguz@LAPTOP-KKDLALF8:~$

Is foreach not supported? What am I doing wrong?

@wader
Copy link

wader commented Feb 27, 2024

See end of this section https://github.com/01mf02/jaq?tab=readme-ov-file#folding about foreach/3

@oguz-ismail
Copy link
Author

@wader Thanks. Why advertise it as a jq clone and waste people's time though?

@01mf02
Copy link
Owner

01mf02 commented Mar 11, 2024

@oguz-ismail, I'm sorry to hear that you feel like your time has been wasted. However, jaq implement a sufficiently large set of jq features that I think that it warrants the name "jq clone". Furthermore, most "clones" are not completely identical to their originals, otherwise what would the point of a clone be?

I guess that some heuristics to warn when foreach/3 is used could have partially prevented your problem. However, I do currently not have the resources to implement such heuristics.

@pkoppstein
Copy link

@01mf02 - Maybe "dialect" would help avoid confusion. That seems to be the compromise in the wikipedia article on jq.

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

4 participants