Nicolas Williams
4b258f7d31
Don't test input_filename/line_number yet
2015-05-21 17:55:27 -05:00
Assaf Gordon
d1cb8ee0ad
Add filename/line functions to jq ( fix #753 )
...
This adds `input_filename` and `input_line_number` built-in functions
for use in, for example, `error` messages.
Example:
$ printf '{"a":1}\n{"a":2}\n' > 4.json
$ printf '{"a":"hello"}\n' > 5.json
$ ./jq '{ "file":input_filename, "line":input_line_number, "value":.a }' 4.json 5.json
{
"file": "4.json",
"line": 1,
"value": 1
}
{
"file": "4.json",
"line": 2,
"value": 2
}
{
"file": "5.json",
"line": 1,
"value": "hello"
}
2015-05-21 00:49:32 -05:00
Nicolas Williams
cbdaeb4062
Fix gsub, add gsub/3 ( fix #782 )
2015-05-18 23:02:11 -05:00
Nicolas Williams
24005287f4
Add $__loc__ ( fix #740 )
2015-03-30 22:36:04 -05:00
Nicolas Williams
1dcfc2f547
Include filename and lineno in error messages
2015-03-30 15:56:29 -05:00
Nicolas Williams
ffa2832e33
Drop name-less label/break for now
...
See #734 and #658 .
2015-03-24 01:21:17 -05:00
Nicolas Williams
ccfba00178
Add more date builtins
2015-03-09 11:27:58 -05:00
Nicolas Williams
a4b9552c82
Add date builtins ( fix #364 )
...
Windows support for strptime() is missing. We can add a copy of one
from a BSD later.
2015-03-06 00:14:15 -06:00
Nicolas Williams
3b8d08177f
Fix #702
2015-02-18 10:21:21 -06:00
Kim Toms
ca78a746e6
Enhance from_entries to better deal with Amazon AWS Tags
2015-02-10 08:33:56 -05:00
Joel Purra
4d05dc55a3
Empty arrays join/1 to an empty string, fixes #668 bug introduced by 9760245
2015-01-14 12:27:55 +01:00
Nicolas Williams
97602456e3
join/1: respect empty strings ( fix #668 )
2015-01-14 01:32:25 -06:00
Nicolas Williams
8b5ff40402
Split on empty sep: fix #552 moar
2015-01-14 01:32:11 -06:00
Nicolas Williams
60d1ecb58a
Fix #552
2015-01-12 10:44:44 -06:00
Nicolas Williams
86bc662bd2
Move some module tests into all.test
2014-12-31 20:09:53 -06:00
Nicolas Williams
7dc34b92af
Add label $name | EXP; fix break
...
This is to fix the problem where `break` is dynamic, not lexical.
With this it should be possible to do this sort of thing:
label $break | inputs | if ... then $break|error else . end
This is a backwards-incompatible change for master, but the previous
`break` hadn't shipped yet.
Still needed:
- testing
2014-12-30 11:42:45 -06:00
Nicolas Williams
cbfc0d6130
Remove string indexing by string ( fix #454 )
...
This turns out to have been a bad idea:
"foo"|.["o"]
it interacts badly with `path()`.
See #454 for the gory details.
2014-12-30 11:31:52 -06:00
pkoppstein
752e00bc66
transpose/0 for possibly jagged matrices
2014-12-27 18:52:36 -06:00
pkoppstein
00f018a054
bsearch(x) (binary search): builtin.c (tested), with documentation and test case. Always yields an integer (even if input is unsorted); returns (-1 - ix) if x is not in input array.
2014-12-27 18:44:20 -06:00
pkoppstein
56344670f4
ascii_upcase/0 and ascii_downcase/0
2014-12-27 18:38:52 -06:00
Nicolas Williams
0053aa868c
Add @tsv; fix #645
2014-12-24 11:21:18 -06:00
Nicolas Williams
be11b2768f
Add until(cond; next); fix #639
2014-12-12 17:35:59 -06:00
William Langford
30e00820a7
Fix #600 . Add regression test
2014-11-12 20:46:34 -05:00
pkoppstein
85f0e30c81
fix sub ( #586 ); add gsub/3; add transpose/0.
...
Signed-off-by: William Langford <wlangfor@gmail.com >
2014-10-06 21:32:07 -04:00
Nicolas Williams
1796a716ea
Restore split/1; don't use regexp ( fix #576 )
2014-10-03 17:58:45 -05:00
Nicolas Williams
20ca21cb0d
Out of bounds negative array indices should raise
2014-08-09 19:15:50 -05:00
Nicolas Williams
2d1a75f550
.foo[-1] = ... trips assertion (fix #490 )
2014-08-09 13:10:41 -05:00
Nicolas Williams
8cddb7c681
Allow any number of jq-coded function arguments
2014-08-09 12:42:39 -05:00
Nicolas Williams
32c08d48f3
Add def f($arg): syntax ( fix #524 )
2014-08-08 19:16:01 -05:00
Nicolas Williams
fc52e78ed4
Fix tests for #432
2014-08-08 18:17:58 -05:00
pkoppstein
a696c6b551
regex filters ( #432 ): scan, splits, split, sub, gsub
2014-08-08 17:00:14 -05:00
Nicolas Williams
a2f99d43c3
Some builtins are unnecessarily special ( fix #521 )
2014-08-01 00:20:30 -05:00
pkoppstein
53993a9942
Add capture; document regular expression filters
...
Fix #493 .
2014-07-28 19:41:21 -05:00
Nicolas Williams
e1b20b48f0
Add first, nth, last ( fix #510 )
2014-07-28 13:18:58 -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