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

Underscores generate syntax errors #7

Closed
nekedorff opened this issue Oct 21, 2012 · 2 comments
Closed

Underscores generate syntax errors #7

nekedorff opened this issue Oct 21, 2012 · 2 comments
Labels

Comments

@nekedorff
Copy link

I'm getting syntax errors from the Twitter examples (and everytime I try to use underscores):

curl 'http://search.twitter.com/search.json?q=json&rpp=5&include_entities=true | jq '.results[] | {from_user, text, urls: [.entities.urls[].url]}'

error: Invalid character
.results[] | {from_user, text, urls: [.entities.urls[].url]}
^
error: syntax error, unexpected IDENT, expecting '}'
.results[] | {from_user, text, urls: [.entities.urls[].url]}
^^^^
2 compile errors
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5970 100 5970 0 0 11969 0 --:--:-- --:--:-- --:--:-- 23050

(Mac OSX Mountain Lion 10.8.2, Swedish keyboard layout)

@stroan
Copy link
Contributor

stroan commented Oct 21, 2012

Adding an extra ' to the end of your url I got the following error with the current jq binary:

curl 'http://search.twitter.com/search.json?q=json&rpp=5&include_entities=true' | ~/Downloads/jq '.results[] | {from_user, text, urls: [.entities.urls[].url]}'
error: Invalid character
.results[] | {from_user, text, urls: [.entities.urls[].url]}
              ^
error: syntax error, unexpected IDENT, expecting '}'
.results[] | {from_user, text, urls: [.entities.urls[].url]}
               ^^^^
2 compile errors
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     

When run against jq built from master it worked as expected. I think this is a duplicate of #3. The binaries should be updated.

@stedolan
Copy link
Contributor

Newer binaries are up now (this bug was fixed a while ago, but the prebuilt binaries weren't updated).

stedolan added a commit that referenced this issue Dec 3, 2012
Useful when "foo" contains unusual characters. Should help with
the issues #7, #38, #40, #42.
@dtolnay dtolnay added the bug label Jul 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants