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

634 Commits

Author SHA1 Message Date
Nicolas Williams
f845808813 Add missing backtick in manual 2014-07-07 17:13:48 -05:00
Nicolas Williams
25719b5596 $var["foo"]=1 can't work as expected; doc fix #236 2014-07-07 16:56:14 -05:00
Nicolas Williams
8780bc0b8e Better check for lib has only functions (fix #138) 2014-07-07 16:03:32 -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
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
9113282c27 Document error/1 2014-07-06 00:27: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
Nicolas Williams
3a647d3e47 Multi-arity needs better errors (fix #438) 2014-07-02 02:18:10 -05:00
Nicolas Williams
1f17ef3623 Descrive generators, range() with by to manual 2014-07-01 23:32:44 -05:00
Nicolas Williams
a6030ab374 Fix typo in manual 2014-07-01 23:32:40 -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
Nicolas Williams
ba1acbe961 Teach disassembler about TAIL_CALL_JQ 2014-07-01 22:49:25 -05:00
Nicolas Williams
9deee38dc8 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.
2014-07-01 22:40:40 -05:00
Nicolas Williams
436941d48b 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.
2014-06-30 23:41:20 -05:00
William Langford
e1c5a2f575 Added cross-compilation script to build libjq for iOS.
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2014-06-30 20:02:19 -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
1204e328df Add much commentary about CALL_JQ and call frames 2014-06-30 19:40:56 -05:00
Nicolas Williams
3e1baf5916 Get "Try Online" button working (fix #440) 2014-06-24 00:39:00 -05:00
Nicolas Williams
beb0d081bb 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.
2014-06-23 19:59:00 -05:00
Nicolas Williams
4b7c701fdd Tail call optimization (close #437) 2014-06-22 00:24:02 -05:00
Nicolas Williams
233e32208c Fix option stacking bug 2014-06-21 18:01:00 -05:00
Nicolas Williams
63e31c2a35 Remove stray fprintf() from last commit 2014-06-20 23:29:53 -05:00
Nicolas Williams
f9349becab Allow stacking of short options (fix #346) 2014-06-20 23:26:54 -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
Nicolas Williams
5d9d1b1020 Partial revamp of scripts/crosscompile
Fix #430.
2014-06-18 16:29:37 -05:00
Nicolas Williams
8725d9fa3e Minor style cleanup in main.c 2014-06-17 19:04:55 -05:00
Nicolas Williams
9ae2d66d21 Remove remnants of --online-input option 2014-06-17 19:02:23 -05:00
Nicolas Williams
0c762925b2 Add -j / --join-output option, similar to -r
Fix #215.
2014-06-17 18:59:35 -05:00
David Haguenauer
ad52026550 Fixed typo.
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2014-06-17 18:47:27 -05:00
Nicolas Williams
cf7895876b Rebuild jq.1.prebuilt 2014-06-17 18:17:50 -05:00
Nicolas Williams
f902d5fae6 Remove trailing whitespace from manual.yml 2014-06-17 18:17:50 -05:00
Nicolas Williams
98e3ebc378 Use new style in manual for defs with args 2014-06-17 18:17:50 -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
7ee3b724d1 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.
2014-06-17 17:00:23 -05:00
Nicolas Williams
e151a300d0 Fix #266; make help message more useful 2014-06-17 16:47:12 -05:00
Nicolas Williams
f58f771660 Fix #280: from_entries of [] is null, should be {} 2014-06-16 22:40:44 -05:00
Nicolas Williams
ea63d5d3c2 No args default w/ tty stdout, not tty stdin #220 2014-06-16 22:34:50 -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
f741074267 Remove download 1.3 button; reposition try online 2014-06-16 17:01:09 -05:00
Nicolas Williams
de5952d67e Add ChangeLog and NEWS files 2014-06-16 15:29:48 -05:00
Nicolas Williams
a03f4802ef Add missing contributors to AUTHORS 2014-06-16 15:29:31 -05:00
Nicolas Williams
778ba9f7ab Update AUTHORS 2014-06-16 13:25:50 -05:00
Nicolas Williams
676e0ce38e Fix Win64 jq.exe link on main page 2014-06-16 11:13:55 -05:00
Nicolas Williams
088a42fc53 Allow multiple functions with different arities 2014-06-16 00:05:30 -05:00