Hanfei Shen
ecac7bd3a1
Fix examples for del in manual
2014-07-09 16:37:17 +08:00
Zhiming Wang and Nicolas Williams
1d620c0de3
Fix invalid YAML in manual.yml
...
Grave accent "`" is a reserved indicator in YAML per
http://www.yaml.org/spec/1.2/spec.html#id2774228 , so it can't start a
plain scalar. This commit applies quoting to titles beginning with
grave accents.
Signed-off-by: Nicolas Williams <[email protected] >
2014-07-09 01:12:23 -05:00
Zhiming Wang and Nicolas Williams
f68815d5ad
Add tests/all.trs to .gitignore
...
tests/all.trs is auto generated during make check.
Signed-off-by: Nicolas Williams <[email protected] >
2014-07-09 01:11:41 -05:00
Nicolas Williams
666aeda82c
Better document path()'s power; also |=
2014-07-09 01:05:06 -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
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
80a9937e48
exec_stack.h was not using jv_mem_realloc()
2014-07-07 19:33:19 -05:00
Nicolas Williams
b963ebaf1d
jv_invalid() shouldn't allocate
...
jv_invalid() should behave like jv_invalid_with_msg(jv_null()), and
neither should allocate memory, because neither ought to need to.
2014-07-07 19:33:18 -05:00
Nicolas Williams
eb45372414
jv_show() should be able to display invalid values
2014-07-07 19:33:18 -05:00
Nicolas Williams
539dccae90
Add break builtin for foreach
2014-07-07 19:33:17 -05:00
Nicolas Williams
6458910ba3
Explain foreach's powers a bit more
2014-07-07 17:22:53 -05:00
Nicolas Williams
ef9b591215
Document path(path_expression) builtin
2014-07-07 17:13:51 -05:00
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 and Nicolas Williams
d0ca11d665
Add support for negative indices for .[]; fix #462
...
Signed-off-by: Nicolas Williams <[email protected] >
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 and Nicolas Williams
9f4d7e2fb8
Fixed base64 issue with UTF-8 strings
...
Signed-off-by: Nicolas Williams <[email protected] >
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 and Nicolas Williams
e1c5a2f575
Added cross-compilation script to build libjq for iOS.
...
Signed-off-by: Nicolas Williams <[email protected] >
2014-06-30 20:02:19 -05:00
Zhiming Wang and Nicolas Williams
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 <[email protected] >
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 and Nicolas Williams
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 <[email protected] >
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 and Nicolas Williams
ad52026550
Fixed typo.
...
Signed-off-by: Nicolas Williams <[email protected] >
2014-06-17 18:47:27 -05:00