Commit Graph
6 Commits
Author SHA1 Message Date
Leonid S. Usov ff8924ce16 Save literal value of the parsed number to preserve it for the output
Extend jv_number to use decNumber for storing number literals. Any math
operations on the numbers will truncate them to double precision.
Comparisons when both numbers are literal numbers will compare them
without truncation.

Delay conversion of numbers to doubles until a math operation is performed,
to preserve precision. A literal jv_number will only need conversion to
double once, and will reuse the resultant double on subsequent
conversions.

Outputting literal jv_numbers preserves the original precision.

Add strong pthread requirement to manage contexts/allocations for
converting numbers between their decNumber, string, and double formats.
2019-04-03 22:20:31 -04:00
Nicolas Williams c72ed135e4 Allow keywords in more places (fix #1868) 2019-03-24 23:19:09 -05:00
Chance Zibolski 4f6045a94e Support "if" without "else" clause
Defaults the else clause to the identity filter "." if an else clause is
missing.

The following two jq programs are considered equivalent:

```
if .foo then
    .foo = "bar"
else
    .
end
```

```
if .foo then
    .foo = "bar"
end
```
2019-02-20 20:03:26 -06:00
Nicolas Williams 38bfec1594 Add flex/bison outputs 2017-03-26 05:36:23 -05:00
David Tolnay 154d0ee4a8 Fix assert fail if object literal key is not a string (fix #953) 2015-09-21 12:47:06 -07:00
David Tolnay 0c93eb3379 Move source files to src/ 2015-08-23 20:36:11 -07:00