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

97 Commits

Author SHA1 Message Date
Nicolas Williams
e1b20b48f0 Add first, nth, last (fix #510) 2014-07-28 13:18:58 -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
10477fc2d4 Make while() handle break 2014-07-09 00:39:25 -05:00
Nicolas Williams
d8672e1b2a Make C-coded built-ins take jq_state * argument 2014-07-07 23:37:42 -05:00
Nicolas Williams
a68958e5dc error(x) should not tostring its arg; fix #466 2014-07-07 22:26:53 -05:00
Nicolas Williams
824f7df404 limit should use break 2014-07-07 22:26:07 -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
821cd31e67 Add any/N and all/N x N in (1, 2) (fix #455)
Contributed by @pkoppstein.
2014-07-06 20:08:06 -05:00
Nicolas Williams
5a863bf010 Add foreach and limit 2014-07-06 19:40:05 -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
Nicolas Williams
ff5cf0abc7 Remove extra free of testmode
I added a jv_free() too many while rebasing @wtlangford's contribution.
It could only be triggered by calling `_match_impl` directly.
2014-06-18 21:11:06 -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
dde43f796e Simplified standard library
Close #426.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2014-06-17 18:17:50 -05:00
Nicolas Williams
f58f771660 Fix #280: from_entries of [] is null, should be {} 2014-06-16 22:40:44 -05:00
Nicolas Williams
ea0ffe24f8 Don't declare environ on WIN32 2014-06-16 22:34:37 -05:00
Santiago Lapresta
061a604a2a Added flatten and flatten(x) functions
Fix #415.
2014-06-16 17:03:05 -05:00
Nicolas Williams
e9a1de47b4 Add env builtin 2014-06-13 17:51:41 -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
Santiago Lapresta
01f676041d Added join function
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2014-06-07 21:53:03 -05:00
Nicolas Williams
6856ab8a69 String * number should be commutative 2014-06-07 21:43:30 -05:00
Santiago Lapresta
41a093c1f2 Added unique_by function 2014-05-12 01:37:27 +02:00
Nicolas Williams
831be04027 Also add scalars 2014-03-13 00:29:53 -05:00
Santiago Lapresta
68f41097b9 Added arrays and other filters
Arrays, objects, numbers, strings, booleans, nulls, values (non-nulls)
-- these builtins filter out those inputs that don't match the name of
the builtin.

This fixes #322 and #324.
2014-03-13 00:27:56 -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
Mike McCabe
336f4e27e6 Initial add of math functions. 2014-02-21 08:46:56 +00: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
Santiago Lapresta
8b41415b07 Added all and any builtins 2014-02-17 04:01:32 +01:00
Nicolas Williams
1fa55a3fae Fix cut-n-paste in leaf_paths; doc and test 'em 2014-02-05 23:14:05 -06:00
Nicolas Williams
a45c937f80 #285 add and builtins 2014-02-05 15:23:32 -06:00
Nicolas Williams
b37ce20c2a Add index and rindex builtins 2013-12-04 18:21:42 -06:00
Nicolas Williams
ae7a042876 Make length return abs value of numeric inputs 2013-12-04 18:21:42 -06:00
Nicolas Williams
eb165459aa Add callback interface for errors
Printing to stderr is not the right answer for a library.
2013-12-04 18:21:41 -06:00
Nicolas Williams
346da34432 Add ltrimstr and rtrimstr functions 2013-12-04 18:21:41 -06:00
Nicolas Williams
255f8ef5be Add tojson and fromjson builtins 2013-12-04 18:21:40 -06:00
Nicolas Williams
cf562961b7 Add string division by string (split on separator) 2013-12-04 18:21:39 -06:00
Nicolas Williams
5989dbdfcf Add string multiplication by number 2013-12-04 18:21:39 -06:00
Nicolas Williams
db19a11399 Add startswith/endswith 2013-12-04 18:21:38 -06:00
Nicolas Williams
6c734cb609 Add explode/implode jq functions to match jv API 2013-12-04 18:21:38 -06:00
Stephen Dolan
4e3024cb61 Merge pull request #182 from mdaines/sqrt-builtin
Add builtin for calculating square root
2013-09-14 16:34:52 -07:00
Stephen Dolan
dae2422fd1 Merge branch 'libjq'
Conflicts:
	Makefile.am
	configure.ac
2013-09-14 19:30:39 +01:00
Michael Daines
82d8253c19 Add sqrt operator 2013-09-11 20:24:41 -04:00
Stephen Dolan
37cfc912c1 Remove #includes from jv.h 2013-06-23 14:23:07 +01:00
Stephen Dolan
1c9e03f800 Merge branch 'header-cleanup' into libjq
Conflicts:
	Makefile.am
2013-06-22 23:27:16 +01: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
Nicolas Williams
298b2a6033 Add libjq autoconf goo 2013-06-21 11:57:12 -05:00