Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
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
|
|
This turns out to have been a bad idea:
"foo"|.["o"]
it interacts badly with `path()`.
See #454 for the gory details.
|
|
|
|
|
|
This will allow moving tests of some tests from tests/run to
tests/all.test. It will also be useful for more extensive testing of
language features where we want nice error messages, or errors at all,
to be produced, particularly language features where the errors arise at
compile-, codegen-, or link-time rather than parse-time.
This does not check for run-time errors though -- those we can already
check for with try/catch.
$ jq --run-tests
%%FAIL
break
jq: error: break used outside labeled control structure
^D
1 of 1 tests passed (0 malformed)
$
|
|
Print the line number and program text on the same output line where a
failure is reported, for all failures that were already reported on
lines starting with '***'. This makes poring over test logs with
failures much easier.
|
|
This will be useful for the upcoming test-erroneous-programs improvement
to --run-tests, so we can switch between the default error reporting
method (print to stderr) to a method internal to --run-tests, and back.
The idea is that when testing programs that are expected to compile (and
link), it'd be nice if errors continue going to stderr, while when
testing programs that must fail to compile (or link), the error has to
be captured so it can be compared to the error expected by the test.
|
|
|
|
|
|
case. Always yields an integer (even if input is unsorted); returns (-1 - ix) if x is not in input array.
|
|
|
|
And refactor setup of jv dump flags.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
$
|
|
Just return a jv_invalid() without a message.
|
|
|
|
Errors were being re-propagated as "break".
Also add `error/0` builtin, which made this fix easier.
|
|
If the caller is at EOF and has no more bytes to feed the parser, how is
the parser to be told about the EOF condition? A small fix to allow
zero-length buffers in jv_parser_set_buf() fixes this problem (it also
makes it easier to deal with async I/O: feed the parser whatever is
available, including nothing).
|
|
|
|
Doc correction
|
|
Added `in` command
|
|
Modify map\1 so that it works on objects
|
|
|
|
|
|
Fix several errors in the manual
|
|
|
|
.travis.yml: Set sudo false; use containers
|
|
The search path listed in an import directive can now be an array. The
top-level search path is appended. Null and empty strings in the path
terminate any search. The "." in "." and "./*" is replaced with the
directory containing the file doing the import (for command-line
programs this is the current directory, though that may be a bad idea).
No version numbers or anything of the sort are gratuitously added to the
search paths.
All this makes external package managers possible by allowing
dependencies to be installed local to dependents.
|
|
|
|
|
|
Define {any,all}/0,1 in terms of {any,all}/2
|
|
|
|
|
|
|
|
This is the way to enable Travis's fancy new containers, which should result in faster builds.
|
|
|
|
|