1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00
Commit Graph

205 Commits

Author SHA1 Message Date
Nicolas Williams
e1b20b48f0 Add first, nth, last (fix #510) 2014-07-28 13:18:58 -05:00
Nicolas Williams
2e2538ccb8 Fold constants (fix #504) 2014-07-27 17:48:49 -05:00
Nicolas Williams
ae27178352 Fix #499, #500 2014-07-27 17:41:40 -05:00
William Langford
38b939688a Added library system with -l, -L, and JQ_LIBRARY_PATH
Created util.[ch] to hold common utilities.
2014-07-22 22:51:11 -05:00
Nicolas Williams
cb2737a433 Add regression test for #479 2014-07-13 19:00:37 -05:00
Nicolas Williams
5be80b81eb Add foreach EXP as $var (INIT; UPDATE) form 2014-07-09 00:43:06 -05:00
Nicolas Williams
10477fc2d4 Make while() handle break 2014-07-09 00:39:25 -05:00
Nicolas Williams
4bcff40828 Make any/2 and all/2 efficient using foreach 2014-07-07 22:25:34 -05:00
Nicolas Williams
539dccae90 Add break builtin for foreach 2014-07-07 19:33:17 -05:00
Nicolas Williams
5a863bf010 Add foreach and limit 2014-07-06 19:40:05 -05:00
William Langford
d0ca11d665 Add support for negative indices for .[]; fix #462
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2014-07-06 01:40:22 -05:00
Nicolas Williams
7d3a44a1e2 Add general ? operator 2014-07-06 01:29:43 -05:00
Nicolas Williams
7fce34292e Add try EXP catch EXP 2014-07-06 01:29:42 -05:00
Nicolas Williams
78a8419428 Add while(cond; update) (fix #314) 2014-07-02 22:05:33 -05:00
Nicolas Williams
ff9a61ead2 Add range(init;upto;by) (fix #317) 2014-07-02 22:05:33 -05:00
William Langford
9f4d7e2fb8 Fixed base64 issue with UTF-8 strings
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2014-07-01 22:56:13 -05:00
Zhiming Wang
a5e9086676 Let @uri produce uppercase hexadecimal digits...
instead of lowercase ones.

According to RFC 3986,

   The uppercase hexadecimal digits 'A' through 'F' are equivalent to
   the lowercase digits 'a' through 'f', respectively.  If two URIs
   differ only in the case of hexadecimal digits used in percent-encoded
   octets, they are equivalent.  For consistency, URI producers and
   normalizers should use uppercase hexadecimal digits for all percent-
   encodings.

See https://github.com/stedolan/jq/issues/451 for details.

Test suite and manual are also updated to reflect this change.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2014-06-30 19:52:42 -05:00
William Langford
8ff935c01a Added regex support as per issue #164.
jq now depends on oniguruma for regex support.
Modified configure.ac accordingly.

Added valgrind suppression file for oniguruma to prevent one-time and bounded
leaks from causing tests to fail.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2014-06-18 21:02:47 -05:00
Santiago Lapresta
061a604a2a Added flatten and flatten(x) functions
Fix #415.
2014-06-16 17:03:05 -05:00
Nicolas Williams
088a42fc53 Allow multiple functions with different arities 2014-06-16 00:05:30 -05:00
Nicolas Williams
46436bd870 Add test of indices with short input 2014-06-08 02:27:27 -05:00
Nicolas Williams
1dbe9317bc Add indices(s), improve index(s), rindex(s)
Now these deal with arrays as input and `s` being an array or a scalar.
2014-06-08 02:01:44 -05:00
Nicolas Williams
74d2216da2 Test arrays and friend filters 2014-03-13 00:29:53 -05:00
Nicolas Williams
4402c6d806 One more recursive merge test 2014-03-12 23:44:21 -05:00
Filippo Valsorda
2aa8a43c5b Add a recursive object merge strategy and bind it to *
This commit adds a jv_object_merge_recursive function, that performs
recursive object merging, and binds it to multiply when applied to
two objects.

Added docs and tests.

Closes #320
2014-03-08 03:56:05 +01:00
Nicolas Williams
219bb9ecb7 Make libm tests more portable 2014-03-06 21:38:10 -06:00
Nicolas Williams
59302fd208 Add missing trig functions and barebones test 2014-02-21 10:49:21 -06:00
Nicolas Williams
fe29d3d3fa Add ?, .[]?, and .. operators
Make XPath-like `//a/b` recursive structure traversal easier in jq,
which then becomes:

    ..|.a?.b?

The `?` operator suppresses errors about . not being an array or object.
The `..` operator is equivalent to calling the new `recurse_down`
built-in, which in turn is equivalent to

    recurse(.[]?)

Note that `..a` is not supported; neither is `...a`.  That could be add
added, but it doesn't seem worth the trouble of saving the need to type
a '|'.
2014-02-20 15:33:07 -06:00
Nicolas Williams
1fa55a3fae Fix cut-n-paste in leaf_paths; doc and test 'em 2014-02-05 23:14:05 -06:00
Stephen Dolan
18e828f17c Allow negated object values without parens. Fixes #247 2013-12-17 22:28:31 +00:00
Stephen Dolan
32ea50d336 Make the testsuite run on machines without valgrind 2013-12-13 15:22:17 +00:00
Stephen Dolan
f147b7fae5 Merge pull request #239 from DRMacIver/overflows
Avoid undefined behaviour with large array indices
2013-12-12 16:38:14 -08:00
Nicolas Williams
474386a1d9 Complete more-arity feature not complete
And test
2013-12-11 14:14:26 -06:00
David R. MacIver
5412f3f1c1 convert range bounds to integers in a way that avoids undefined behaviour 2013-12-10 09:20:13 +00:00
David R. MacIver
014b45b4a9 add checking of numeric indices to an array to see if they can reasonably be considered integers. Avoid undefined behaviour if out of bounds 2013-12-10 09:20:12 +00:00
Nicolas Williams
426edff09c Add tests for string index by string and builtins 2013-12-04 18:21:42 -06:00
Nicolas Williams
9fa2173825 Test ltrimstr and rtrimstr functions 2013-12-04 18:21:41 -06:00
Nicolas Williams
3c4248192d Test tojson and fromjson 2013-12-04 18:21:40 -06:00
Nicolas Williams
da129f6664 Test string slicing 2013-12-04 18:21:39 -06:00
Nicolas Williams
5aadaa79eb Add tests for string division/splitting 2013-12-04 18:21:39 -06:00
Nicolas Williams
63bed9bdf1 Test starts/endswith and string multiplication 2013-12-04 18:21:39 -06:00
Nicolas Pouillard
a0b942a7f5 Add a few more test cases (from the man page)
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2013-11-30 00:55:26 -06:00
Stephen Dolan
8d4748c8df Fix a crash on group_by of empty list. Fixes #208. 2013-11-07 12:18:48 +00:00
Michael Daines
c427bf6a94 Add test showing calculation of standard deviation 2013-09-14 17:48:19 -04:00
Michael Daines
82d8253c19 Add sqrt operator 2013-09-11 20:24:41 -04:00
Nicolas Williams
7c4171d414 Add floor operator 2013-06-21 15:27:34 -05:00
Nicolas Williams
3403d07912 Add mod (and setmod) operators 2013-06-21 15:27:34 -05:00
Stephen Dolan
81e2336ace Support ."foo" syntax for accessing fields. See #141. 2013-06-11 22:26:39 +01:00
Stephen Dolan
bc42812715 Remove the insane "fold" operation, replace with saner "reduce". 2013-05-16 15:07:53 +01:00
Stephen Dolan
e83e51eb56 'length' function now measures string length in codepoints, not bytes. 2013-05-15 00:37:38 +01:00