]> granicus.if.org Git - jq/log
jq
10 years agoAdd `foreach` and `limit`
Nicolas Williams [Sun, 6 Jul 2014 08:24:29 +0000 (03:24 -0500)]
Add `foreach` and `limit`

10 years agoAdd support for negative indices for .[]; fix #462
William Langford [Fri, 4 Jul 2014 16:08:47 +0000 (12:08 -0400)]
Add support for negative indices for .[]; fix #462

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
10 years agoAdd general `?` operator
Nicolas Williams [Sun, 6 Jul 2014 05:11:55 +0000 (00:11 -0500)]
Add general `?` operator

10 years agoAdd `try EXP catch EXP`
Nicolas Williams [Sun, 6 Jul 2014 01:54:42 +0000 (20:54 -0500)]
Add `try EXP catch EXP`

10 years agoDocument `error/1`
Nicolas Williams [Sun, 6 Jul 2014 05:26:22 +0000 (00:26 -0500)]
Document `error/1`

10 years agoAdd `while(cond; update)` (fix #314)
Nicolas Williams [Thu, 3 Jul 2014 02:45:49 +0000 (21:45 -0500)]
Add `while(cond; update)` (fix #314)

10 years agoAdd `range(init;upto;by)` (fix #317)
Nicolas Williams [Thu, 3 Jul 2014 02:22:53 +0000 (21:22 -0500)]
Add `range(init;upto;by)` (fix #317)

10 years agoMulti-arity needs better errors (fix #438)
Nicolas Williams [Wed, 2 Jul 2014 07:18:10 +0000 (02:18 -0500)]
Multi-arity needs better errors (fix #438)

10 years agoDescrive generators, range() with by to manual
Nicolas Williams [Wed, 2 Jul 2014 04:32:44 +0000 (23:32 -0500)]
Descrive generators, range() with by to manual

10 years agoFix typo in manual
Nicolas Williams [Wed, 2 Jul 2014 04:32:40 +0000 (23:32 -0500)]
Fix typo in manual

10 years agoFixed base64 issue with UTF-8 strings
William Langford [Tue, 1 Jul 2014 17:17:48 +0000 (13:17 -0400)]
Fixed base64 issue with UTF-8 strings

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
10 years agoTeach disassembler about TAIL_CALL_JQ
Nicolas Williams [Wed, 2 Jul 2014 03:49:25 +0000 (22:49 -0500)]
Teach disassembler about TAIL_CALL_JQ

10 years agoFix off-by-one in TCO
Nicolas Williams [Wed, 2 Jul 2014 03:40:40 +0000 (22:40 -0500)]
Fix off-by-one in TCO

    Now we have the ability to define a generator in jq:

        def for(cond; update):
            def _for:
                if cond then ., (update | _for) else . end;
            _for;

        for(. < 10; . + 1) # generates numbers between `.` and 10

    Running this by hand with --debug-dump-disasm (with a fix for that
    coming up next) we can see that the call to _for is optimized:

        _for:0:
          0000 DUP
          0001 CALL_JQ cond:0^1
          0005 JUMP_F 0022
          0007 POP
          0008 FORK 0012
          0010 JUMP 0020
          0012 CALL_JQ update:1^1
          0016 TAIL_CALL_JQ _for:0^1
          0020 JUMP 0023
          0022 POP
          0023 RET

    And timing this with 1000, 10000, 100000 iterations shows that
    indeed we must be applying TCO; otherwise, without TCO, this gets
    very slow very quickly.

10 years agoTCO to the max!
Nicolas Williams [Tue, 1 Jul 2014 04:41:20 +0000 (23:41 -0500)]
TCO to the max!

    Close #446.

    Currently tested by disassembling and tracing various recursive jq
    programs by hand under valgrind.  An improved test framework that
    can test for errors and specific bytecode patterns is in
    development.

10 years agoAdded cross-compilation script to build libjq for iOS.
William Langford [Wed, 25 Jun 2014 07:13:17 +0000 (03:13 -0400)]
Added cross-compilation script to build libjq for iOS.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
10 years agoLet @uri produce uppercase hexadecimal digits...
Zhiming Wang [Mon, 30 Jun 2014 02:48:01 +0000 (19:48 -0700)]
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>
10 years agoAdd much commentary about CALL_JQ and call frames
Nicolas Williams [Tue, 1 Jul 2014 00:40:56 +0000 (19:40 -0500)]
Add much commentary about CALL_JQ and call frames

10 years agoGet "Try Online" button working (fix #440)
Nicolas Williams [Tue, 24 Jun 2014 05:39:00 +0000 (00:39 -0500)]
Get "Try Online" button working (fix #440)

10 years agoImprove TCO
Nicolas Williams [Tue, 24 Jun 2014 00:59:00 +0000 (19:59 -0500)]
Improve TCO

Instead of checking for self-recursion check that the thing we're
calling is a function and not a closure, therefore the new frame will
have the same env as the current frame.

10 years agoTail call optimization (close #437)
Nicolas Williams [Sun, 22 Jun 2014 05:24:02 +0000 (00:24 -0500)]
Tail call optimization (close #437)

10 years agoFix option stacking bug
Nicolas Williams [Sat, 21 Jun 2014 23:01:00 +0000 (18:01 -0500)]
Fix option stacking bug

10 years agoRemove stray fprintf() from last commit
Nicolas Williams [Sat, 21 Jun 2014 04:29:53 +0000 (23:29 -0500)]
Remove stray fprintf() from last commit

10 years agoAllow stacking of short options (fix #346)
Nicolas Williams [Sat, 21 Jun 2014 04:26:54 +0000 (23:26 -0500)]
Allow stacking of short options (fix #346)

10 years agoRemove extra free of testmode
Nicolas Williams [Thu, 19 Jun 2014 02:11:06 +0000 (21:11 -0500)]
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.

10 years agoAdded regex support as per issue #164.
William Langford [Wed, 18 Jun 2014 23:49:38 +0000 (19:49 -0400)]
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>
10 years agoPartial revamp of `scripts/crosscompile`
Nicolas Williams [Wed, 18 Jun 2014 21:29:37 +0000 (16:29 -0500)]
Partial revamp of `scripts/crosscompile`

Fix #430.

10 years agoMinor style cleanup in main.c
Nicolas Williams [Wed, 18 Jun 2014 00:04:55 +0000 (19:04 -0500)]
Minor style cleanup in main.c

10 years agoRemove remnants of `--online-input` option
Nicolas Williams [Wed, 18 Jun 2014 00:02:23 +0000 (19:02 -0500)]
Remove remnants of `--online-input` option

10 years agoAdd `-j` / `--join-output` option, similar to `-r`
Nicolas Williams [Tue, 17 Jun 2014 23:59:35 +0000 (18:59 -0500)]
Add `-j` / `--join-output` option, similar to `-r`

Fix #215.

10 years agoFixed typo.
David Haguenauer [Thu, 20 Mar 2014 20:31:09 +0000 (21:31 +0100)]
Fixed typo.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
10 years agoRebuild jq.1.prebuilt
Nicolas Williams [Tue, 17 Jun 2014 23:13:35 +0000 (18:13 -0500)]
Rebuild jq.1.prebuilt

10 years agoRemove trailing whitespace from manual.yml
Nicolas Williams [Tue, 17 Jun 2014 23:13:14 +0000 (18:13 -0500)]
Remove trailing whitespace from manual.yml

10 years agoUse new style in manual for defs with args
Nicolas Williams [Tue, 17 Jun 2014 23:11:31 +0000 (18:11 -0500)]
Use new style in manual for defs with args

10 years agoSimplified standard library
Santiago Lapresta [Tue, 17 Jun 2014 22:15:22 +0000 (00:15 +0200)]
Simplified standard library

Close #426.

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
10 years agoFix #419, improve Cannot index message (sortof)
Nicolas Williams [Tue, 17 Jun 2014 22:00:23 +0000 (17:00 -0500)]
Fix #419, improve Cannot index message (sortof)

jv_get() doesn't know if it's being called in the context of a jq
program or not, so it can't produce a very useful error message when the
types of the to-be-indexed value and the key don't agree.  For now,
including the key (when it is a short string) in the error message is as
significant an improvement as is easy to make.

10 years agoFix #266; make help message more useful
Nicolas Williams [Tue, 17 Jun 2014 21:47:12 +0000 (16:47 -0500)]
Fix #266; make help message more useful

10 years agoFix #280: from_entries of [] is null, should be {}
Nicolas Williams [Tue, 17 Jun 2014 03:40:44 +0000 (22:40 -0500)]
Fix #280: from_entries of [] is null, should be {}

10 years agoNo args default w/ tty stdout, not tty stdin #220
Nicolas Williams [Tue, 17 Jun 2014 02:28:30 +0000 (21:28 -0500)]
No args default w/ tty stdout, not tty stdin #220

10 years agoDon't declare environ on WIN32
Nicolas Williams [Tue, 17 Jun 2014 03:33:24 +0000 (22:33 -0500)]
Don't declare environ on WIN32

10 years agoAdded `flatten` and `flatten(x)` functions
Santiago Lapresta [Mon, 16 Jun 2014 00:34:18 +0000 (02:34 +0200)]
Added `flatten` and `flatten(x)` functions

Fix #415.

10 years agoRemove download 1.3 button; reposition try online
Nicolas Williams [Mon, 16 Jun 2014 22:01:09 +0000 (17:01 -0500)]
Remove download 1.3 button; reposition try online

10 years agoAdd ChangeLog and NEWS files
Nicolas Williams [Mon, 16 Jun 2014 20:29:48 +0000 (15:29 -0500)]
Add ChangeLog and NEWS files

10 years agoAdd missing contributors to AUTHORS
Nicolas Williams [Mon, 16 Jun 2014 20:29:31 +0000 (15:29 -0500)]
Add missing contributors to AUTHORS

10 years agoUpdate AUTHORS
Nicolas Williams [Mon, 16 Jun 2014 18:25:50 +0000 (13:25 -0500)]
Update AUTHORS

10 years agoFix Win64 jq.exe link on main page
Nicolas Williams [Mon, 16 Jun 2014 16:13:55 +0000 (11:13 -0500)]
Fix Win64 jq.exe link on main page

10 years agoAllow multiple functions with different arities
Nicolas Williams [Sun, 15 Jun 2014 04:53:15 +0000 (23:53 -0500)]
Allow multiple functions with different arities

10 years agoFix typo; rename jq.1-prebuit to jq.1.prebuilt
Nicolas Williams [Sat, 14 Jun 2014 00:04:06 +0000 (19:04 -0500)]
Fix typo; rename jq.1-prebuit to jq.1.prebuilt

10 years agoAdd `env` builtin
Nicolas Williams [Fri, 13 Jun 2014 22:51:41 +0000 (17:51 -0500)]
Add `env` builtin

10 years agoDocument the lambda nature of function args #391
Nicolas Williams [Fri, 13 Jun 2014 22:22:43 +0000 (17:22 -0500)]
Document the lambda nature of function args #391

10 years agoAutomatically update jq.1.prebuilt
Nicolas Williams [Fri, 13 Jun 2014 22:22:17 +0000 (17:22 -0500)]
Automatically update jq.1.prebuilt

10 years agoAdd jqplay link to the site
Nicolas Williams [Fri, 13 Jun 2014 22:21:56 +0000 (17:21 -0500)]
Add jqplay link to the site

10 years agojqplay has a domain now 408/head
Jingwen Owen Ou [Fri, 13 Jun 2014 01:17:39 +0000 (18:17 -0700)]
jqplay has a domain now

10 years agoAdd links to Solaris 11+ executables
Nicolas Williams [Fri, 13 Jun 2014 00:26:05 +0000 (19:26 -0500)]
Add links to Solaris 11+ executables

10 years agoInclude links to 1.3 executables in gh-pages
Nicolas Williams [Thu, 12 Jun 2014 22:30:30 +0000 (17:30 -0500)]
Include links to 1.3 executables in gh-pages

10 years agoMake a better jq.1 when Ruby deps missing
Nicolas Williams [Thu, 12 Jun 2014 22:30:09 +0000 (17:30 -0500)]
Make a better jq.1 when Ruby deps missing

10 years agoMerge pull request #400 from kdeme/master
Nico Williams [Thu, 12 Jun 2014 20:55:41 +0000 (15:55 -0500)]
Merge pull request #400 from kdeme/master

Heuristic IEEE754 endianness autoconf detection

Use AC_C_BIGENDIAN, though it's not really the correct approach.  Autoconf ought to have provided a test specifically for IEEE754 endianness, since it can differ from integer/pointer endianness!

10 years agoDetect endianness at configuration with Autoconf AC_C_BIGENDIAN feature 400/head
Kim De Mey [Wed, 11 Jun 2014 08:37:32 +0000 (10:37 +0200)]
Detect endianness at configuration with Autoconf AC_C_BIGENDIAN feature

10 years agoAdd lib.h to dist file list jq-1.4
Nicolas Williams [Mon, 9 Jun 2014 23:58:46 +0000 (18:58 -0500)]
Add lib.h to dist file list

10 years agoMake the note about shell quoting appear on site
Nicolas Williams [Mon, 9 Jun 2014 22:43:17 +0000 (17:43 -0500)]
Make the note about shell quoting appear on site

10 years agoAdd note about cmd.exe quoting
Nicolas Williams [Mon, 9 Jun 2014 15:22:55 +0000 (10:22 -0500)]
Add note about cmd.exe quoting

10 years agoBuilding docs fails on powerpc (#349)
Nicolas Williams [Mon, 9 Jun 2014 14:39:02 +0000 (09:39 -0500)]
Building docs fails on powerpc (#349)

Thanks @shym!!

10 years agoUpdate site news
Nicolas Williams [Mon, 9 Jun 2014 01:45:06 +0000 (20:45 -0500)]
Update site news

10 years agoAlso fix configure.ac to use git describe --tags
Nicolas Williams [Mon, 9 Jun 2014 00:36:06 +0000 (19:36 -0500)]
Also fix configure.ac to use git describe --tags

10 years agoFix scripts/version: use git describe --tags ...
Nicolas Williams [Mon, 9 Jun 2014 00:31:21 +0000 (19:31 -0500)]
Fix scripts/version: use git describe --tags ...

After tagging as 1.4 scripts/version was still producing jq-1.3-....

10 years agoAdd test of `indices` with short input
Nicolas Williams [Sun, 8 Jun 2014 07:27:27 +0000 (02:27 -0500)]
Add test of `indices` with short input

10 years agoAdd `indices(s)`, improve `index(s)`, `rindex(s)`
Nicolas Williams [Sun, 8 Jun 2014 07:01:44 +0000 (02:01 -0500)]
Add `indices(s)`, improve `index(s)`, `rindex(s)`

Now these deal with arrays as input and `s` being an array or a scalar.

10 years agoImprove `index` and `rindex` examples
Nicolas Williams [Sun, 8 Jun 2014 07:01:21 +0000 (02:01 -0500)]
Improve `index` and `rindex` examples

10 years agoRemove reference to `getpath` from docs
Nicolas Williams [Sun, 8 Jun 2014 06:35:03 +0000 (01:35 -0500)]
Remove reference to `getpath` from docs

10 years agoDocument `index` and `rindex` (#389)
Nicolas Williams [Sun, 8 Jun 2014 05:00:17 +0000 (00:00 -0500)]
Document `index` and `rindex` (#389)

10 years agoAdded `join` function
Santiago Lapresta [Thu, 29 May 2014 22:45:16 +0000 (00:45 +0200)]
Added `join` function

Signed-off-by: Nicolas Williams <nico@cryptonector.com>
10 years agoString * number should be commutative
Nicolas Williams [Sun, 8 Jun 2014 02:43:30 +0000 (21:43 -0500)]
String * number should be commutative

10 years agoAdd cross-compilation notes to README
Nicolas Williams [Wed, 4 Jun 2014 23:29:30 +0000 (18:29 -0500)]
Add cross-compilation notes to README

A detailed set of instruction as to how to setup a cross-compilation
environment for OS X and Win32/64 would be nice.

10 years agoAdd -j option to scripts/crosscompile
Nicolas Williams [Wed, 4 Jun 2014 23:15:44 +0000 (18:15 -0500)]
Add -j option to scripts/crosscompile

10 years agoAdd flags argument to jv_parser_new()
Nicolas Williams [Wed, 4 Jun 2014 23:17:27 +0000 (18:17 -0500)]
Add flags argument to jv_parser_new()

For extensibility.  We might add streaming parser options, even binary
JSON encoding options.

10 years agoRevert "Add -I / --online-input for huge top-level arrays"
Nicolas Williams [Wed, 4 Jun 2014 23:01:47 +0000 (18:01 -0500)]
Revert "Add -I / --online-input for huge top-level arrays"

This reverts commit 77936a594d797c480f26bfcef3636a74588a6918.

There are too many odd bugs in this mode, and it turns out to be a bad
idea anyways.  Instead, in the future a better option will be to pursue
alternative parsers, such as:

 - streaming parser that outputs only when a new leaf value is added or
   an array/object is opened/closed; options here include whether to
   include a path in each output;

 - parsers for binary JSON encodings (there's a variety of them).

Then one might run jq with a streaming parser and use `reduce` to
coalesce inputs from some depth down (instead of from one level down as
the reverted commit had intended).

Besides, a fully streaming parser is desirable in some cases, therefore
we should have such a thing as an option.

I've explored modifying the current parser to support a streaming
option, but it only makes the code very difficult to follow, which is
one reason that alternate parsers makes sense.  At any rate, this is all
for the future.  For now there's no streaming of individual texts, just
text sequences.

10 years agoFix tests failures on Windows
Nicolas Williams [Mon, 2 Jun 2014 05:56:01 +0000 (00:56 -0500)]
Fix tests failures on Windows

And Solaris 8 and 9 too, no doubt.  The problem was that non-standard
vsnprintf()s that return -1 when the buffer is too small were not
properly supported.

10 years agoUpdate .gitignore and config/.gitignore
Nicolas Williams [Mon, 2 Jun 2014 03:15:46 +0000 (22:15 -0500)]
Update .gitignore and config/.gitignore

10 years agoMerge pull request #367 from slapresta/del-docs
Nico Williams [Wed, 21 May 2014 03:11:01 +0000 (22:11 -0500)]
Merge pull request #367 from slapresta/del-docs

Documented `del` command

10 years agoDocumented `del` command 367/head
Santiago Lapresta [Tue, 20 May 2014 23:23:28 +0000 (01:23 +0200)]
Documented `del` command

10 years agoMerge pull request #360 from slapresta/275-unique-by
Nico Williams [Mon, 12 May 2014 05:30:55 +0000 (00:30 -0500)]
Merge pull request #360 from slapresta/275-unique-by

unique_by(.foo) function

10 years agoAdded texts/examples to unique_by function 360/head
Santiago Lapresta [Sun, 11 May 2014 23:43:00 +0000 (01:43 +0200)]
Added texts/examples to unique_by function

10 years agoAdded unique_by function
Santiago Lapresta [Sun, 11 May 2014 23:37:27 +0000 (01:37 +0200)]
Added unique_by function

10 years agoMake pthread tls configurable for Mingw build
Nicolas Williams [Fri, 18 Apr 2014 01:17:06 +0000 (20:17 -0500)]
Make pthread tls configurable for Mingw build

For the Mingw build we don't want to pull in the pthread DLL just
because we can autodetect pthread support.  That would make the jq.exe
binary not self-contained.

10 years agoAdd autoconf checks for pthreads; fix #340
Nicolas Williams [Wed, 16 Apr 2014 23:42:36 +0000 (18:42 -0500)]
Add autoconf checks for pthreads; fix #340

10 years agoMerge pull request #332 from jingweno/master
Nico Williams [Fri, 21 Mar 2014 04:47:40 +0000 (23:47 -0500)]
Merge pull request #332 from jingweno/master

Add link to jq playground

10 years agoAdd link to jqplay 332/head
Jingwen Owen Ou [Thu, 20 Mar 2014 22:47:18 +0000 (15:47 -0700)]
Add link to jqplay

10 years agoMerge pull request #176 from pearkes/new-tutorial
Nico Williams [Thu, 13 Mar 2014 05:57:54 +0000 (00:57 -0500)]
Merge pull request #176 from pearkes/new-tutorial

Docs: Update the tutorial to use GitHub's API

10 years agoFix for #303 in the sources
Nicolas Williams [Thu, 13 Mar 2014 05:49:56 +0000 (00:49 -0500)]
Fix for #303 in the sources

10 years agoMerge pull request #278 from polyester/master
Nico Williams [Thu, 13 Mar 2014 05:52:58 +0000 (00:52 -0500)]
Merge pull request #278 from polyester/master

work with newer versions of automake

10 years agoTest `arrays` and friend filters
Nicolas Williams [Thu, 13 Mar 2014 05:27:49 +0000 (00:27 -0500)]
Test `arrays` and friend filters

10 years agoDocument `scalars`
Nicolas Williams [Thu, 13 Mar 2014 05:22:36 +0000 (00:22 -0500)]
Document `scalars`

10 years agoAlso add `scalars`
Nicolas Williams [Thu, 13 Mar 2014 05:16:33 +0000 (00:16 -0500)]
Also add `scalars`

10 years agoDocument `arrays`, `objects`, ...
Nicolas Williams [Thu, 13 Mar 2014 05:19:55 +0000 (00:19 -0500)]
Document `arrays`, `objects`, ...

10 years agoAdded `arrays` and other filters
Santiago Lapresta [Mon, 10 Mar 2014 00:35:44 +0000 (01:35 +0100)]
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.

10 years agoOne more recursive merge test
Nicolas Williams [Thu, 13 Mar 2014 04:44:21 +0000 (23:44 -0500)]
One more recursive merge test

10 years agoAdd a recursive object merge strategy and bind it to * 321/head
Filippo Valsorda [Sat, 8 Mar 2014 02:56:05 +0000 (03:56 +0100)]
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

10 years agoMake libm tests more portable
Nicolas Williams [Fri, 7 Mar 2014 03:38:10 +0000 (21:38 -0600)]
Make libm tests more portable

10 years agoMerge pull request #310 from arodland/master
Nico Williams [Mon, 3 Mar 2014 19:46:38 +0000 (13:46 -0600)]
Merge pull request #310 from arodland/master

Make jq --raw-output --unbuffered work

10 years agoRepair jv_show 310/head
Andrew Rodland [Wed, 26 Feb 2014 07:43:00 +0000 (01:43 -0600)]
Repair jv_show

10 years agoMake jq --raw-output --unbuffered work
Andrew Rodland [Wed, 26 Feb 2014 07:38:46 +0000 (01:38 -0600)]
Make jq --raw-output --unbuffered work

--unbuffered was only affecting the normal output case, not the --raw-output case. Make the two of them play together.

This also makes sure that the output is flushed *after* printing the newline, so a consumer doesn't lag a line behind.