summaryrefslogtreecommitdiffstats
path: root/builtin.c
AgeCommit message (Collapse)Author
2014-12-31Further module system revamp (fix #659)Nicolas Williams
To import a module now use: # Import module.jq file: import "relative/path/to/module" as foo; # Use the module's defs as foo::<def-name> To import a JSON file: # Read file.json: import "relative/path/to/file" as $foo; # # Use as $foo::foo Using `-L` now drops the builtin library path and appends the requested path to the empty array (or the result of an earlier `-L`). Support for the `$JQ_LIBRARY_PATH` environment variable has been removed.
2014-12-30Add `label $name | EXP`; fix `break`Nicolas Williams
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-30Remove string indexing by string (fix #454)Nicolas Williams
This turns out to have been a bad idea: "foo"|.["o"] it interacts badly with `path()`. See #454 for the gory details.
2014-12-27bsearch(x) (binary search): builtin.c (tested), with documentation and test ↵pkoppstein
case. Always yields an integer (even if input is unsorted); returns (-1 - ix) if x is not in input array.
2014-12-27ascii_upcase/0 and ascii_downcase/0pkoppstein
2014-12-27Add `debug` builtinNicolas Williams
And refactor setup of jv dump flags.
2014-12-27Don't force C API users to set input cbNicolas Williams
2014-12-26Add Streaming parser (--stream)Nicolas Williams
Streaming means that outputs are produced as soon as possible. With the `foreach` syntax one can write programs which reduce portions of the streaming parse of a large input (reduce into proper JSON values, for example), and discard the rest, processing incrementally. This: $ jq -c --stream . should produce the same output as this: $ jq -c '. as $dot | path(..) as $p | $dot | getpath($p) | [$p,.]' The output of `jq --stream .` should be a sequence of`[[<path>],<leaf>]` and `[[<path>]]` values. The latter indicate that the array/object at that path ended. Scalars and empty arrays and objects are leaf values for this purpose. For example, a truncated input produces a path as soon as possible, then later the error: $ printf '[0,\n'|./jq -c --stream . [[0],0] parse error: Unfinished JSON term at EOF at line 3, column 0 $
2014-12-26Fix `foreach` non-progation of errorsNicolas Williams
Errors were being re-propagated as "break". Also add `error/0` builtin, which made this fix easier.
2014-12-26Fix in and insideNicolas Williams
2014-12-26Merge pull request #366 from slapresta/inversed-containsNico Williams
Added `in` command
2014-12-26Merge pull request #628 from slapresta/map-on-objectsNico Williams
Modify map\1 so that it works on objects
2014-12-24Add @tsv; fix #645Nicolas Williams
2014-12-23Merge pull request #601 from slapresta/redefine-any-allNico Williams
Define {any,all}/0,1 in terms of {any,all}/2
2014-12-23Make `values` faster (fix #652)Nicolas Williams
2014-12-22Define `map_values`Santiago Lapresta
2014-12-22`in` is now `inside`, added `in` as inverse of `has`Santiago Lapresta
2014-12-22Added `in` commandSantiago Lapresta
2014-12-12Add until(cond; next); fix #639Nicolas Williams
2014-11-12Fix #600. Add regression testWilliam Langford
2014-10-21Define {any,all}/2 independently from {any,all}/0Santiago Lapresta
2014-10-20Define {any,all}/{0,1} in terms of {any,all}/2Santiago Lapresta
2014-10-06Properly call onig_error_code_to_strWilliam Langford
Fix #585
2014-10-06fix sub (#586); add gsub/3; add transpose/0.pkoppstein
Signed-off-by: William Langford <wlangfor@gmail.com>
2014-10-03Restore `split/1`; don't use regexp (fix #576)Nicolas Williams
2014-10-03from-entries should work with EC2 (fix #592)Nicolas Williams
2014-10-03Remove sort/1 and group/1Nicolas Williams
Reserve these for sorting with jq-coded comparators.
2014-09-30to_entries should not sort keys (fix #561)Nicolas Williams
2014-08-21C-coded builtins should not assert (fix #553)Nicolas Williams
2014-08-14Add `module` directive, `modulemeta` builtinNicolas Williams
Fix #425.
2014-08-11Fix #549Nicolas Williams
2014-08-09More constant folding: null, true, and falseNicolas Williams
A step towards doing constant folding for arrays and objects.
2014-08-08Make `nwise` privateNicolas Williams
2014-08-08Make regexp builtins and range/3 use #524 tooNicolas Williams
2014-08-08Use `def f($a): ...;` syntax for builtinsNicolas Williams
2014-08-08regex filters (#432): scan, splits, split, sub, gsubpkoppstein
2014-08-04Apply TCO to recurse/1, add recurse/2; tweak docspkoppstein
Signed-off-by: Nicolas Williams <nico@cryptonector.com>
2014-08-01Some builtins are unnecessarily special (fix #521)Nicolas Williams
2014-07-28Add capture; document regular expression filterspkoppstein
Fix #493.
2014-07-28Add `first`, `nth`, `last` (fix #510)Nicolas Williams
2014-07-22Added library system with -l, -L, and JQ_LIBRARY_PATHWilliam Langford
Created util.[ch] to hold common utilities.
2014-07-09Make `while()` handle `break`Nicolas Williams
2014-07-07Make C-coded built-ins take `jq_state *` argumentNicolas Williams
2014-07-07`error(x)` should not `tostring` its arg; fix #466Nicolas Williams
2014-07-07`limit` should use `break`Nicolas Williams
2014-07-07Make `any/2` and `all/2` efficient using `foreach`Nicolas Williams
2014-07-07Add `break` builtin for `foreach`Nicolas Williams
2014-07-06Add `any/N` and `all/N` x N in (1, 2) (fix #455)Nicolas Williams
Contributed by @pkoppstein.
2014-07-06Add `foreach` and `limit`Nicolas Williams
2014-07-02Add `while(cond; update)` (fix #314)Nicolas Williams