-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Lexer bug: e100
mistaken for numeric literal when it should be an identifier
#1526
Comments
I would agree that this is a bug, but you can easily work around it by writing The problem arises because jq sees
The point is that .e100a looks like a floating point |
but I really can't change e100 to e100a, it's a car type, so is it possible to fix this ? |
Sorry, I meant .[“e100”] |
not work by this command: cat test.json| jq '.test.["e100"].car9' jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at , line 1: |
You really should read the documentation. In the meantime:
|
Shame on me ~ |
Also good: $ jq '.test["e100"].car9' test.json and $ jq '.test."e100".car9' test.json |
This is the bag regexp in
It should be:
|
We probably also need a rule that matches invalid numbers and produces an error. E.g.,
|
Can you try this patch:
? |
e100
mistaken for numeric literal when it should be an identifier
Also found an issue with parse error: Invalid numeric literal at line 1295060, column 909 (this seems like the same error. If not I will open a new case) This came from a file I was using a .py script to combine some logs. I got the error there with "UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 2338: character maps to " which adding encoding="utf8") to my open command allowed for processing. |
|
Thanks all, this is awesome after long time. |
I found a bug: version: jq-1.5-1-a5b5cbe os: Ubuntu 16.04LTS
testcase1:
{
"test": {
"e100": {
"car9": {
"enabled": 1
}
}
}
}
command: cat test.json| jq '.test.e100.car9'
jq: error: Invalid numeric literal at EOF at line 1, column 5 (while parsing '.e100') at , line 1:
.test.e100.car9
jq: error: syntax error, unexpected LITERAL, expecting $end (Unix shell quoting issues?) at , line 1:
.test.e100.car9
jq: 2 compile errors
testcase2
{
"test": {
"e100a": {
"car9": {
"enabled": 1
}
}
}
}
command: cat test.json| jq '.test.e100a.car9'
it will works.
Please help to fix this, Thanks!
The text was updated successfully, but these errors were encountered: