William Langford
46d1ce2667
Restore JV_PRINT_COLOUR as an alias
...
JV_PRINT_COLOUR was part of the public libjq headers and was removed as
part of 2d05b54 . While JV_PRINT_COLOR is definitely the preferred
spelling this side of the pond, we shouldn't just remove otherwise
exposed enum values.
2018-08-17 23:23:10 -04:00
William Langford
0673dee1b3
Fix destructuring alternation
...
Attempting to use the existing FORK_OPT opcode resulted in difficulty
knowing when to pop an error message off the stack and when not to. This
commit makes DESTRUCTURE_ALT a real opcode that is identical to
FORK_OPT, except for never pushing the error message onto the stack when
continuing from an error backtrack.
Some small changes were necessary to the DUP/POP behavior surrounding
destructuring to accomodate this.
2018-08-17 23:15:48 -04:00
William Langford
3dc5f4e948
Create issue template
2018-08-17 09:15:08 -04:00
Roland C. Dowdeswell
90bc29c1b5
jv_file.c: check to see if the file is a directory and fail
...
Not all stdio implementations disallow one to open a directory with
fopen(3) and so we specifically check for directories as it is also
in the standard search path.
2018-05-11 19:32:25 -05:00
Nicolas Williams
7fd9e86ea6
Make limit/2 more efficient
...
Contributed by @pkoppstein.
2018-03-06 16:35:33 -06:00
Nicolas Williams
e113c67d51
limit/2 evals exp one time too many
2018-03-06 11:29:13 -06:00
rain1
bf88c73c20
src/main.c: fix issue #1587 by using jv_dumpf in the raw-output and ascii-output case. retain fwrite in the raw-output case.
2018-03-01 14:33:47 -06:00
Riley Avron
ae11f111a5
Fix "provides" typo
2018-02-23 14:10:47 -06:00
David Fetter
2ce1e323df
Change backticks to the more legible $()
2018-02-20 15:54:21 -05:00
Jakub Jirutka
68d0048148
Build static binaries and deploy to GH Releases from Travis
2018-02-20 12:11:28 -05:00
Jakub Jirutka
bafb43e589
Build and run tests against musl libc using Alpine Linux on Travis
2018-02-20 12:11:28 -05:00
Jakub Jirutka
c163e88af3
Change Travis config to utilize Build Stages
...
See: https://docs.travis-ci.com/user/build-stages/
2018-02-20 12:11:28 -05:00
Paul Chvostek
bd34b8dd2e
fix FreeBSD install instructions
2018-01-04 15:50:20 -06:00
Larry Aasen
61edf3fa93
Updated the compile-ios.sh script to fix issues with local oniguruma path.
2017-12-12 18:27:59 -06:00
Nicolas Williams
8eff744eec
Update AUTHORS
2017-12-11 12:22:02 -06:00
David Fetter
b4742c1257
Added rawfile
...
In passing, clean remnants of argfile from slurpfile docs.
2017-12-11 12:17:17 -06:00
Nicolas Williams
9a4576e756
Revert "reduce: handle empty updates ( fix #1313 )"
...
This reverts commit e24af3c78e .
While the semantics are desirable, there is no way to implement them
efficiently. The reason is that in order to handle backtracking (empty)
from the state update expression, we have to retain a reference to the
reduction state value in order to restore it upon backtracking.
Retaining a reference to the reduction state kills performance by
causing lots of additional memory allocations and garbage because the
input to the update expression will always have at least two references,
thus no changes to it can be done in-place, and all changes end up being
CoW changes.
Avoiding this is the very reason for the LOADVN instruction (leaving
`null` in the variable loaded from).
2017-12-11 11:20:16 -06:00
Nicolas Williams
b5560d8420
Fix import as $data linking
2017-12-10 23:09:35 -06:00
William Langford
79ece35981
Fix hang for slurped inputs with trailing newline
2017-12-04 20:10:56 -05:00
William Langford
f06deb828a
Fix #1534
2017-12-04 19:20:58 -05:00
William Langford
0c9eacedaa
Actually fix the strptime tests
...
This has been a complicated issue to fix for a number of reasons.
The core of it is that the behavior is different between different
versions of macOS, some of which set possible-but-incorrect values.
This commit addresses the issue by always using our computation for
tm_wday and tm_yday on macOS. As a side-effect, strptime format
strings that specify %u and %j will no longer work on macOS.
2017-11-29 20:47:56 -05:00
Eric Bréchemier
476b36770d
Keep object keys in parsing order in tostream output
...
As noted by @nicowilliams, `tostream` used `keys`,
which sorts the keys in alphabetical order, instead
of `keys_unsorted`, which preserves the parsing order.
Fixes #1541 .
2017-11-29 11:46:08 -06:00
Andrew Speed
239278fd3a
Use rvm to install ruby 1.9.3
2017-11-28 08:51:38 -05:00
William Langford
98b36e74b8
Fix strptime tests on macOS 10.12
...
Dates in 1900 are before the Unix epoch. We shouldn't make any promises
about how well they are supported, especially given that our time
support is a thin wrapper over the libc functions.
This changes the test to use dates after the epoch, which should fit
within both a signed and an unsigned 32-bit time_t.
2017-11-27 22:57:50 -05:00
William Langford
c3cbbdd8a2
Fix memory leaks in various c-coded builtins
2017-11-27 20:37:14 -05:00
Nicolas Williams
18879fb993
Fix leak on error in strptime
2017-11-23 01:51:22 -06:00
trantor
bdaddcf107
Typo correction
...
Suppresion -> Suppression
2017-11-22 13:47:35 -05:00
William Langford
7b81a836c3
Merge pull request #1403 from Argoday/master
...
Use unsorted keys in walk
2017-06-19 10:55:26 -04:00
Nicolas Williams
c538237f4e
Deal with strptime() on OS X and *BSD ( fix #1415 )
...
strptime() on OS X and *BSDs (reputedly) does not set tm_wday and
tm_yday unless corresponding %U and %j format specifiers were used.
That can be... surprising when one parsed year, month, and day anyways.
Glibc's strptime() conveniently sets tm_wday and tm_yday in those cases,
but OS X's does not, ignoring them completely.
This commit makes jq compute those where possible, though the day of
week computation may be wrong for dates before 1900-03-01 or after
2099-12-31.
2017-05-21 16:24:48 -05:00
Nicolas Williams
4a6241be06
Attempt to fix #1415
...
OS X (and *BSD) strptime() does not set tm_wday nor tm_yday unless
corresponding format options are used. That means we must call timegm()
to set them.
2017-05-21 01:58:18 -05:00
Nicolas Williams
1900c7bcac
Add private my_timegm()
2017-05-21 01:57:55 -05:00
Nicolas Williams
578d536233
Fix HAVE_TM_TM_GMT_OFF usage
2017-05-21 01:53:00 -05:00
Nicolas Williams
b0d6d28310
Use AC_CHECK_MATH_FUNC() for all math functions
2017-05-21 01:22:39 -05:00
Nicolas Williams
10d66051ef
Fix jv_load_file() assertion ( fix #1410 )
2017-05-20 18:53:48 -05:00
Daniel Lange
cb3d5aff84
Improved git build instructions.
2017-05-11 09:05:56 -04:00
Jonathan Word
ca12bd9b5d
Use unsorted keys in walk
...
Preserve key sorting order when executing in walk, if sorted keys is desired `--sort-keys` should be used to explicitly obtain sorted keys.
2017-05-03 15:49:21 -04:00
Nico Williams
6d89e297fe
Add JQ_COLORS env var for color config ( fix #1252 )
2017-04-29 14:00:52 -04:00
Nicolas Williams
32d8f2000a
Fix build
2017-04-26 20:55:50 -05:00
Nicolas Williams
0bd7614bd5
Always use jv_mem_*alloc()
2017-04-21 18:41:06 -05:00
pkoppstein
4b4cf789e0
def isempty(g) # Testing 'isempty(empty)' at line number 1364
2017-04-15 16:45:00 -05:00
William Langford
76b1fc18f1
Update oniguruma to fix #1370
2017-04-02 14:58:59 -04:00
William Langford
405071337d
Don't require java to build gh-pages
2017-03-31 18:48:28 -04:00
William Langford
151b494382
Add collect example with pipeline
2017-03-31 18:48:05 -04:00
William Langford
12f74b226e
Add missing close-backtick in docs
2017-03-30 22:23:47 -04:00
Nicolas Williams
18753cb7a7
Also fix jn/2 and yn/2
2017-03-30 11:46:03 -05:00
Nicolas Williams
71d4ff6ed8
Fix frexp, modf, lgamma_r ( fix #1374 )
2017-03-29 00:07:42 -05:00
Nicolas Williams
7935d307f0
Allow . as {$a:$b} destructuring
2017-03-26 05:36:23 -05:00
Nicolas Williams
38bfec1594
Add flex/bison outputs
2017-03-26 05:36:23 -05:00
Nicolas Williams
2421dfb843
Add more destructuring tests
2017-03-26 05:36:22 -05:00
William Langford
94035be3fa
Add --debug-trace=all for detailed debug output
...
When tracing execution, print the whole stack, not just the items used by the
current opcode
2017-03-26 05:36:22 -05:00
William Langford
c8a2a0acc2
Fix a tripped assertion when generating reduces
...
A noop body, while useless, should still compile successfully
2017-03-26 05:36:22 -05:00
William Langford
3a8c8f4747
Add alternation destructuring operator ?//
...
This is a first pass to show the implementation.
It needs tests and evaluation, but doesn't break any existing tests.
NOT READY FOR MERGING
2017-03-26 05:36:22 -05:00
Nicolas Williams
b142d484d5
Conditional exprs are not path exprs ( fix #1368 )
...
The conditional expression in if-then-elif-else-end cannot contribute to
path expressions because it doesn't change the input to any of the then/
elif/else expressions. These must be generated via gen_subexp().
See also #1366 .
2017-03-15 01:07:37 -05:00
Nicolas Williams
674e9fb7c2
Make and build dist in travis-CI ( #1356 )
2017-03-04 23:14:36 -06:00
Nicolas Williams
6878123202
Make configure.ac work for shallow clones
2017-03-04 22:57:35 -06:00
Nicolas Williams
f7bf9a8e96
Make scripts/version work in shallow clones
...
Shallow clones don't have tags. Use git describe --always --dirty in
such cases.
XXX Add branch name.
2017-03-03 14:30:58 -06:00
Nicolas Williams
89809a2d0f
Fix make dist
2017-03-01 23:01:08 -06:00
Nicolas Williams
9df19f53e4
Fix off-by-one bug in #1108 fix
2017-03-01 22:45:02 -06:00
Nicolas Williams
65cbaac344
Array slice overflows ( fix #1108 )
2017-03-01 17:48:45 -06:00
Nicolas Williams
2fcb257168
getpath/1 should be a path expression ( fix #1358 )
...
It needs to be possible to do something like
getpath($paths[]) += 1
meaning: increment all the paths in . that are listed in $paths[].
In order to do this getpath() needs to update the jq->path and
jq->value_at_path as necessary.
2017-02-28 21:54:30 -06:00
William Langford
63791b795a
Fix name of builtins in the builtins/0 output
2017-02-26 19:50:10 -05:00
Nicolas Williams
ea90b947b0
Fix warning about environ
2017-02-26 18:22:30 -06:00
Nicolas Williams
9a0d796298
Fix --without-oniguruma build
2017-02-26 18:22:23 -06:00
Nicolas Williams
0337027d54
Fix environ Win32 build problem
2017-02-26 18:06:35 -06:00
Nicolas Williams
8ea21a54ad
Add halt, halt_error builtins ( fix #386 )
2017-02-26 16:34:56 -06:00
Nicolas Williams
6bac4ed059
Document stderr
2017-02-26 16:34:56 -06:00
Nicolas Williams
a03ae02f44
Fix memory leak
2017-02-26 16:33:50 -06:00
Nicolas Williams
45f126514c
Fix Appveyor for non-master branches
2017-02-26 16:13:22 -06:00
Nicolas Williams
b279713e47
fixup
2017-02-26 16:12:57 -06:00
Nicolas Williams
3504bd9a2a
Add $ENV builtin variable to access environment
2017-02-26 00:39:24 -06:00
Nicolas Williams
1a8a0ae0f5
Fix error message for undefined vars
2017-02-26 00:37:28 -06:00
Nicolas Williams
441b066dd8
Preserve precious vars in configure.ac ( fix #795 )
2017-02-25 21:49:38 -06:00
Nicolas Williams
ef87010059
Document $ARGS and friends
2017-02-25 19:21:06 -06:00
Nicolas Williams
66fb962a66
Add $ARGS, --args and --jsonargs ( fix #1345 )
2017-02-25 19:13:28 -06:00
Nicolas Williams
e8abc0a2f6
jq_compile_args(): allow object args to be object
2017-02-25 19:13:28 -06:00
Nicolas Williams
7b1bd99de6
Add jv_object_has()
2017-02-25 19:13:28 -06:00
Nicolas Williams
8619c6e060
Make test/shtest test of constant folding robust
...
Rather than testing that a constant expression produces so many
instructions, test that a variety of of such expressions produce the
same number of instructions. This will make future changes in the
compiler less likely to break this test.
2017-02-25 19:13:28 -06:00
Nicolas Williams
2e1f2db8b5
Improve Appveyor build
...
Among other things, make TESTS=... breaks when using modules/oniguruma,
so set SUBDIRS= then.
2017-02-25 18:57:38 -06:00
Nicolas Williams
ba32b33796
Windows: configure fails to detect missing math
...
For some reason AC_CHECK_MATH_FUNC() on Windows is not detecting a
handful of math functions as not being supported. This commit is a bit
of a hack.
2017-02-25 18:51:09 -06:00
Nicolas Williams
6e77b017c5
Make comment consistent with code
2017-02-25 18:51:09 -06:00
Yasuhiro Matsumoto
5d058fa416
Don't call SetConsoleOutputCP
...
Should use wide-string function instead of SetConsoleOutputCP.
Fixes #1121
2017-02-25 18:51:04 -06:00
Yasuhiro Matsumoto
12c60b2f32
Quiet a compiler warning
2017-02-25 18:49:22 -06:00
Nicolas Williams
9801de6979
Windows: Also use -lshlwapi for jq(1)
2017-02-25 14:49:20 -06:00
Nicolas Williams
c695f2cd9c
When using builtin Oniguruma, set flags correctly
...
This should fix the Travis-CI build.
2017-02-25 14:11:42 -06:00
Nicolas Williams
27c29aeb7b
Document localtime and strflocaltime
2017-02-23 23:39:24 -06:00
Nicolas Williams
06f20603f6
Add localtime and strflocaltime ( fix #1349 )
2017-02-23 22:26:53 -06:00
Nicolas Williams
607a9e3912
Improve manual section on assignment forms
2017-02-23 22:17:54 -06:00
Nicolas Williams
d3b4ad04f5
Revert e7caf68 for Dockerfile
2017-02-23 22:01:43 -06:00
Nicolas Williams
e7caf68edd
Attempt to use builtin Oniguruma for CIs
2017-02-23 00:33:08 -06:00
Nicolas Williams
c6374b6a1f
Allow ./configure --with-oniguruma=builtin
...
This allows one to force the use of jq's builtin copy of Oniguruma
(builtin as a git submodule).
We still need to fix make dist to include that copy of Oniguruma.
2017-02-23 00:30:13 -06:00
Nicolas Williams
8cde328007
Allow var bindings in path expressions ( #1347 )
...
The expression in a variable binding is not and must not be seen as
being part of a path expression in which the variable binding appears.
2017-02-21 18:11:35 -06:00
Erik Brinkman
02bad4b298
Add local oniguruma submodule
...
Configure should still allow use of prebuilt onigurumas (whether
system-installed or in a special prefix). If these are not found, and
configure was not called with `--without-oniguruma`, then use the vendored
oniguruma module. If configure was called with `--without-oniguruma`, then we
do not build regex functionality into jq.
2017-02-18 21:34:26 -05:00
Nicolas Williams
9b2179089b
Improve manual
2017-02-15 11:48:39 -06:00
William Langford
1c806b74ea
Add builtins builtin
2017-02-13 11:36:20 -05:00
William Langford
8001955fb7
Fix memory leak in libm cfunctions
2017-02-13 11:36:20 -05:00
William Langford
e6fa039f3f
Merge pull request #1089 from l8nite/base64_decode
2017-02-12 16:25:44 -05:00
Shaun Guth
e0b784ac6d
Add @base64d for decoding base64 #47
2017-02-12 16:03:59 -05:00
J Phani Mahesh
dc679081fa
fix truncate_stream to match docs
2017-02-07 21:30:55 -06:00
Nicolas Williams
597c1f6667
Add more missing math functions
2017-02-04 00:11:46 -06:00
Nicolas Williams
125071cf00
Fix handling of unsupported math functions
2017-02-04 00:11:10 -06:00
Nicolas Williams
2fb099e4cf
Promote wiki more in README
2017-01-31 16:13:32 -06:00
Nicolas Williams
6f9646a44f
Improve docs somewhat, inspired by #1326
2017-01-30 14:11:05 -06:00
Nicolas Williams
bd7b48c1b9
Make |= delete LHS when RHS is empty ( Fix #1314 )
...
Now that #1313 is fixed, |= no longer outputs null when the RHS update
expression outputs empty.
When a user wants to keep the current value of the LHS they would have
the RHS update expression output `.`, so having `empty` achieve the same
thing would be redundant. The obvious thing to do is to delete the LHS
when the RHS update outputs `empty` (i.e., doesn't output any values).
It's reasonable to think that existing programs won't be broken by this
change, because reduce and |= not handling empty well is clearly a bug.
(Though it's possible that some programs were using empty to quickly
terminate reduce or |=, it's not likely. They should use label/break
instead.)
Prior to this change |= would use the _last_ value output by the RHS
update expression. With this change |= will use the _first_ value
instead. This change _is_ a minor backwards-incompatible change. It
may or may not be acceptable; we'll see. It is a useful change in that
it makes |= faster when the update expression produces multiple values.
2017-01-30 14:11:05 -06:00
Nicolas Williams
aac8132f47
recurse (i.e., ..) needs to find leaf nulls
2017-01-30 14:11:05 -06:00
Nicolas Williams
7bdf3a39ad
Add SQL-style operators ( #1322 )
2017-01-30 14:11:05 -06:00
Nicolas Williams
396543191c
Make first(g) more efficient: extract only 1 value
...
first(g) was extracting two values, which, if g is slow, made first(g)
slow. And if the second extraction were to throw an error, then
first(g) would throw that error, which is clearly not the right thing to
do. Besides that, first(g) was allocating garbage, which it no longer
does.
2017-01-30 14:11:05 -06:00
Nicolas Williams
e24af3c78e
reduce: handle empty updates ( fix #1313 )
2017-01-30 14:11:05 -06:00
Attila Fülöp
e82147bbb8
Solaris needs XPG6 for c99
2017-01-28 19:16:23 -06:00
William Langford
d2c3cf49e1
Merge pull request #1317 from wtlangford/dont-split-utf8-sequences
...
Handle cut-off UTF-8 sequences when reading files
2017-01-27 21:45:15 -05:00
William Langford
e84d17196c
Handle cut-off UTF-8 sequences when reading files
...
Read additional bytes from the file to complete the UTF-8 sequence so the bytes
in it don't get converted to U+FFFD replacement characters.
2017-01-27 21:04:26 -05:00
W-Mark Kubacki
fd4ae8304e
Parse no deeper than MAX_PARSING_DEPTH
...
while true; do printf '{"deeper": '; done | jq .
2017-01-27 09:59:44 -06:00
W-Mark Kubacki
83e2cf607f
Skip printing what's below a MAX_PRINT_DEPTH
...
This addresses #1136 , and mitigates a stack exhaustion when printing
a very deeply nested term.
2017-01-27 09:59:44 -06:00
Jakub Wilk
61b75639a7
gen_utf8_tables: remove unused variable
2017-01-26 13:15:59 -06:00
Jan Schulz
19d266b528
Revert "Disable appveyor build for now"
...
This reverts commit 0b8218515e .
There is a new oniguruma package which previously trashed the build.
2017-01-23 16:28:01 -06:00
Richard Groves
9c4238c2f6
Typo fixed
...
simply -> simple
2017-01-23 16:21:37 -06:00
Janne Cederberg
114ac72169
Documentation clarification suggestions
2017-01-23 15:48:44 -06:00
James Pearson Hughes
a10d7fbb02
Update download instructions for Arch
...
jq has been in the community repo for [just over a year now][0].
[0]: https://projects.archlinux.org/svntogit/community.git/commit/trunk?h=packages/jq&id=8d5e06065bc92bf56ea651970c9bda07fb545554
2017-01-23 15:46:17 -06:00
Tim McCormack
f33af0b16a
Typo: s/more/mode/ in --seq
2017-01-23 15:45:07 -06:00
Clément MATHIEU
eeba7b3167
Fix input_(line_number|filename) leak memory
2017-01-23 15:18:51 -06:00
Jay Satiro
e5c30e6fae
Fix cross-compile tmp dir removal
...
- cd out of the tmp dir before attempting to remove it.
2017-01-23 15:10:57 -06:00
Nicolas Williams
0b8218515e
Disable appveyor build for now
2016-03-21 18:59:52 -05:00
David Tolnay
1a8a5ee000
Remove David from maintainers
2016-02-24 00:39:56 -08:00
Nicolas Williams
1740fd036d
Travis-CI build for OSX ( fix #1083 )
2016-01-19 00:19:24 -06:00
Nicolas Williams
6c635998f8
Always test sort_by/group_by post-#1082
2016-01-18 12:17:58 -06:00
Stephen Dolan
7835a724d6
Make jv_sort stable regardless of qsort details.
2016-01-18 10:41:25 -06:00
Stephen Dolan
239c357af0
Add AppVeyor badge to README.md
...
Thanks @JanSchulz, @nicowilliams!
2016-01-18 10:15:43 +00:00
Nicolas Williams
d228490162
Add --enable-ubsan (undefined behavior sanitizer)
2016-01-17 13:06:27 -06:00
Nicolas Williams
b92a12cf6c
Run failing tests on Windows; ignore failures
2016-01-17 12:46:57 -06:00
Nicolas Williams
c514368f98
Make it possible to run tests with set -x
...
One can now run:
make TRACE_TESTS=1 check
to get detailed output
2016-01-17 12:45:01 -06:00
Nicolas Williams
062f86a625
Enable more tests on Windows; move sort_by tests
...
Use %%FAIL IGNORE MSG for error messages that differ on Windows, and
move the sort_by/group_by tests that fail qhen qsort() is not stable.
Now only tests/sorttest and tests/shtest are disabled on Windows.
2016-01-17 12:45:01 -06:00
Nicolas Williams
c3d13260a7
Tweak appveyor.yml; disable failing tests
2016-01-17 01:49:50 -06:00
Jan Schulz
e6e07cd2c6
Upload build failure logs
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2016-01-16 17:02:43 -06:00
Jan Schulz
ec4dfd32cc
Build a html help
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2016-01-16 17:02:43 -06:00
Jan Schulz
c0e01452f2
Run tests on appveyor
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2016-01-16 17:02:43 -06:00
Jan Schulz
45260890f2
Add 32bit windows builds on appveyor
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2016-01-16 17:02:43 -06:00
Jan Schulz
4337fc5fe0
Build on windows (mingw) on appveyor
...
For this to work, one of the core commiter should do:
* enable appveyor in the github project (grant access)
* Make an appveyor account and add the github jq repo as a new project
inspirations from:
appveyor, msys2, use bash environment to build...
* https://github.com/ariscop/elemental-ircd/blob/appveyor/appveyor.yml
* https://github.com/khaledhosny/ots/pull/67/files
* https://github.com/universal-ctags/ctags/blob/master/appveyor.yml
* https://github.com/universal-ctags/ctags/blob/master/win32/appveyor.bat
and with mvsc
* https://github.com/khaledhosny/ots/blob/master/.appveyor.yml
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2016-01-16 17:02:43 -06:00
Nicolas Williams
093d20c3b9
Fix cross-compilation build
2016-01-16 16:51:06 -06:00
Nicolas Williams
ec07936888
Fix Windows build ( fix #911 )
2016-01-16 16:51:01 -06:00
Nicolas Williams
8e4724e16c
fixup non-maintainer build
2016-01-15 16:06:18 -06:00
Nicolas Williams
3afdbb7b7d
Always build src/builtin.inc ( fix #1069 )
2016-01-15 11:59:14 -06:00
Nicolas Williams
f217fa26ae
MultiByteToWideChar() usage bug ( fix #1072 )
2016-01-15 11:58:41 -06:00
Nicolas Williams
8f6f28c8d3
Make it easier to use jq with shebangs ( fix #1044 )
...
Allow a continuation on a comment immediately after a shebang to make
this traditional hack possible:
#!/bin/sh
# this next line is ignored by jq \
exec jq -f "$0" "$@"
# jq code follows
But continue only on the first line following a shebang, and only if
it's a comment.
2015-12-14 22:08:17 -08:00
Nicolas Williams
856a4b2f3f
Add note about IEEE754 to help msg
2015-12-15 00:00:03 -06:00
Cameron Sparr
6d76cd0a99
Change usage formatting
2015-12-14 23:58:28 -06:00
Romero Malaquias
6151f20477
Avoiding conditional directives that break statements
2015-12-09 15:29:35 -06:00
pkoppstein
ad8d1a8cc8
Two sub bugs fixed; two new gsub tests have been added.
...
./jq --run-tests < tests/onig.test
has been run successfully:
...
Testing 'gsub("a";"b")' at line number 70
Testing 'gsub( "(.*)"; ""; "x")' at line number 74
...
22 of 22 tests passed (0 malformed)
2015-12-09 15:28:01 -06:00
Nicolas Williams
ec583deefa
Fix JV_OBJECT() and go up to 18
2015-12-01 23:27:19 -06:00
Nicolas Williams
5fe053671a
Assume . if either stdin/on isatty() ( fix #1028 )
...
And move the #define of isatty on Windows up.
2015-12-01 23:27:19 -06:00
Mark McKinstry
0d177d240d
yum has been replaced with dnf as of f22
...
https://fedoraproject.org/wiki/Changes/ReplaceYumWithDNF
2015-11-26 10:48:06 -05:00
David Tolnay
18b4b18b41
Support --without-oniguruma
2015-11-21 10:05:37 -08:00
David Tolnay
befd192958
Oniguruma hash in dockerfile
2015-11-18 00:30:18 -08:00
Loamhoof
79f9ecd150
Fix manual signature for split (non-regex)
2015-11-15 21:43:38 +01:00
Nicolas Williams
8f115e9eed
Add address sanitizer (ASAN) support ( fix #1002 )
2015-10-27 20:06:21 -05:00
David Tolnay
e17ccf2297
Support numbers and boolean in join ( fix #930 )
2015-10-25 12:40:15 -07:00
Nicolas Williams
8eb1367ca4
Heap buffer overflow in tokenadd() ( fix #105 )
...
This was an off-by one: the NUL terminator byte was not allocated on
resize. This was triggered by JSON-encoded numbers longer than 256
bytes.
2015-10-24 17:27:56 -05:00
David Tolnay
2f79004f85
strptime() on OpenBSD requires _XOPEN_SOURCE_EXTENDED 1 ( fix #999 )
...
strptime() is an XPG4v2 function, on OpenBSD the prototype
is not included in time.h unless visibility is set, it needs
either "#define _XOPEN_SOURCE_EXTENDED 1" or _XOPEN_SOURCE
>= 500. Without this the prototype isn't included and
strptime's returned pointer is truncated to an int, causing
SEGV on 64-bit arches when using it.
Thanks @sthen
2015-10-24 11:23:56 -07:00
David Tolnay
b7a219a91d
mktemp needs 6 or more X's ( fix #1000 )
...
mktemp(1) isn't posix specified, but it's reasonable to use
mktemp(3) to implement it which requires 6 trailing X's in
the format
Thanks @sthen
2015-10-24 11:21:18 -07:00
Nicolas Williams
aa279ae7ac
Fix builtin.o dependency ( #992 )
2015-10-22 22:33:47 -05:00
Nicolas Williams
4060535f9f
Fix linux32 jq-1.5 executable ( fix #935 )
2015-10-22 22:07:34 -05:00
Nicolas Williams
1847333342
Rename sig/v1.5/jq-linux32.asc (prep for #935 )
2015-10-22 22:06:27 -05:00
Nicolas Williams
87c278c8a5
Remove setup.sh ( fix #993 )
2015-10-22 21:53:53 -05:00
David Tolnay
143e8dc5e4
Move jq-coded builtins to non-C file ( fix #424 )
2015-10-22 19:26:00 -07:00
David Tolnay
b80d58e167
Move docs for map earlier ( fix #288 )
2015-10-17 23:54:07 -07:00
David Tolnay
6c31850e86
If-then-else documentation for forking conditional ( fix #942 )
2015-10-17 21:15:24 -07:00
David Tolnay
c8dc164566
Support lowercase name in from_entries ( fix #990 )
2015-10-17 20:50:40 -07:00
David Tolnay
32e5e6af4b
Revert "Adjust spacing of section headers to account for nav bar ( fix #986 )"
...
This reverts commit 73b8413d10 .
The fix for #986 caused #988 .
2015-10-13 23:29:57 -07:00
David Tolnay
4a886f831c
Autocomplete manual search to first result on submit
2015-10-13 10:48:06 -07:00
David Tolnay
e3c36777ab
Add background color to typeahead menu
2015-10-12 22:50:03 -07:00
David Tolnay
c2395f0278
Sort manual search results shortest to longest
2015-10-12 22:35:37 -07:00
David Tolnay
0791261f07
Remove backticks from manual headers and search strings
2015-10-12 22:30:16 -07:00
David Tolnay
73b8413d10
Adjust spacing of section headers to account for nav bar ( fix #986 )
2015-10-12 22:12:37 -07:00
David Tolnay
664b8e26f0
Merge typeaheadjs.css into base.scss
2015-10-12 21:03:42 -07:00
David Tolnay
64ade137bc
PGP signatures for release binaries ( fix #889 )
2015-10-12 20:57:53 -07:00
David Tolnay
da15e10bd0
Accept only bitwise identical NaN values in jv_identical ( fix #978 )
2015-10-12 20:47:22 -07:00
David Tolnay
1f7c24fea7
Add signing key and dtolnay's key fingerprints to KEYS
2015-10-12 20:07:24 -07:00
Nicolas Williams
49b8382c5f
Remove expired key from KEYS
2015-10-12 19:11:52 -05:00
Nicolas Williams
583ab589dc
Add KEYS file
2015-10-12 19:01:02 -05:00
David Tolnay
c80c07ab68
Link to BootstrapCDN for Bootstrap and Bootswatch ( fix #985 )
2015-10-12 12:19:25 -07:00
David Tolnay
c5875504da
Explicitly use current directory in Rakefile
2015-10-12 10:46:17 -07:00
David Tolnay
05d1c09cc1
Split up Rakefile to minimize dependencies ( fix #435 )
2015-10-12 10:42:15 -07:00
David Tolnay
9d6e91ea7b
Add description for rake tasks
...
You can see the descriptions by running `rake --tasks`.
2015-10-12 10:21:18 -07:00
David Tolnay
4887cfd951
Remove duplicate yaml import in Rakefile
2015-10-12 10:10:56 -07:00
David Tolnay
9a51696bc0
Remove old Rakefile dist targets
...
Because binaries no longer go into the repo.
2015-10-12 10:03:18 -07:00
Simon Elsbrock
bf271b8062
docs: jq 1.5 is now available in Debian unstable
...
It may take some time until it bubbles up into Ubuntu repositories.
2015-10-12 10:02:07 +02:00
David Tolnay
2864fb467e
Bump fedora and chocolatey available version numbers
2015-10-02 19:19:36 -07:00
David Tolnay
4490d9d1f6
Support NaN in path expressions ( fix #962 )
2015-09-24 10:33:34 -07:00
Nicolas Williams
c4524da3e0
EOF after newline in string mishandled ( fix #951 )
2015-09-22 20:11:54 -07:00
David Tolnay
58f082d74f
Delete negative indices in array ( fix #954 )
2015-09-21 20:33:06 -07:00
David Tolnay
154d0ee4a8
Fix assert fail if object literal key is not a string ( fix #953 )
2015-09-21 12:47:06 -07:00
Roman Inflianskas
83ab4e273b
Add openSUSE repository
2015-09-20 08:15:15 -07:00
David Tolnay
dccda74062
Address comments on PR #950
2015-09-16 10:48:50 -07:00
David Tolnay
b52bebfbe8
Improve invalid object key error message
2015-09-16 09:53:42 -07:00
David Tolnay
1758c1ba74
Remove "Requires 1.5" from manuals
...
No longer necessary now that manuals are versioned.
2015-09-13 18:57:11 -07:00
Joel Nothman
83e8ec587f
utf8bytelength: count UTF8 string bytelength
...
[Builtin name changed, and it only works on string inputs. -Nico]
2015-09-13 01:01:24 -05:00
Steven Penny
63dd033da7
Fix segmentation fault on Windows with long paths ( fix #939 )
2015-09-10 21:29:34 -07:00
David Tolnay
91f0dcff5c
Avoid passing '/bin/bash' as default argument to docker run
...
Previously:
```
$ docker run dbdc663dabc8
jq: error: syntax error, unexpected '/', expecting $end (Unix shell quoting issues?) at <top-level>, line 1:
/bin/bash
jq: 1 compile error
$ docker run --entrypoint /bin/echo dbdc663dabc8
/bin/bash
```
Now:
```
$ docker run e36393e8c15e
jq - commandline JSON processor [version 1.5rc2-77-g9a3fe9e]
Usage: /usr/local/bin/jq [options] <jq filter> [file...]
jq is a tool for processing JSON inputs, applying the
...
```
2015-09-05 13:03:01 -07:00
David Tolnay
688bb1993f
Get oniguruma from github instead of geocities
2015-09-05 12:40:42 -07:00
David Tolnay
94bda489ce
Fix indentation in Dockerfile
2015-09-05 11:54:56 -07:00
David Tolnay
c9003e521c
Add travis and coveralls badges to readme
2015-08-25 08:48:40 -07:00
Stephen Dolan
8105255be2
No-op commit to trigger first run of Travis.
2015-08-25 15:36:54 +01:00
Nicolas Williams
f57743eb37
Remove jq.1.default and related content
2015-08-23 23:08:11 -05:00
David Tolnay
0c93eb3379
Move source files to src/
2015-08-23 20:36:11 -07:00
David Tolnay
891f28ef5e
Copy gitignore in website update script
2015-08-22 17:26:58 -07:00
David Tolnay
371e74a25f
Remove obsolete comment in Makefile.am
2015-08-22 16:27:06 -07:00
David Tolnay
9ec27fe362
Sort source file lists in Makefile.am
2015-08-22 16:20:21 -07:00
David Tolnay
75662a4b05
Standardize indentation in Makefile.am
...
This was being done 5 different way in 5 places:
- indent 3 spaces, then tabs to column 73
- indent 2 spaces, then tabs to column 73
- indent 2 spaces, then a single tab
- indent with spaces up to equal sign, then tabs to column 73
- indent 1 tab, then tabs to column 73
I standardized on 8 spaces, then spaces to column 73. The 8
spaces lines up with common browsers' indentation of the
rest of the makefile, which is indented by single tabs. The
spaces to column 73 make sure the trailing backslashes line
up regardless of the tabstop setting.
2015-08-22 15:31:50 -07:00
David Tolnay
4a993dff29
Add gcov output to gitignore
2015-08-22 14:47:07 -07:00
David Tolnay
516e79151f
Include "jv.h" instead of <jv.h>
2015-08-22 13:53:44 -07:00
David Tolnay
6c3934de15
Fix decoding of UTF-8 sequence length ( fix #922 )
2015-08-22 12:31:36 -07:00
David Tolnay
370833d555
Sort libm functions
2015-08-22 10:54:35 -07:00
David Tolnay
302ae77712
Remove unused libm functions
2015-08-21 09:45:16 -07:00
Frederic Cambus
5d23c240b6
Use 'snprintf' instead of 'sprintf'
...
This gets rid of a linker warning when compiling on OpenBSD:
./.libs/libjq.a(jv_print.o)(.text+0x2fc): In function `jvp_dump_string':
/root/jq-1.5/jv_print.c:118: warning: sprintf() is often misused, please use snprintf()
2015-08-20 14:48:58 -07:00
David Tolnay
7032228879
Hide manual jqplay button and navigation in print mode
2015-08-20 11:14:14 -07:00
David Tolnay
8932cf719f
Hide tutorial "show result" button in print mode
2015-08-20 00:02:09 -07:00
David Tolnay
7668a4f255
Expand all manual examples in print mode
2015-08-19 23:27:10 -07:00
David Tolnay
2c6c521799
Add FreeBSD install instructions ( fix #917 )
2015-08-18 08:21:57 -07:00
David Tolnay
19577fcefa
Link to correct 1.5 source tarball
2015-08-17 18:04:56 -07:00
David Tolnay
b8f71d3659
Fix assert fail when delpaths is given non-array ( fix #901 )
2015-08-16 19:44:16 -07:00
David Tolnay
2d05b5475c
Standardize on "color" to match what the flag has always been called
2015-08-16 19:19:29 -07:00
David Tolnay
44a5c4b0b1
Fix "the the" in manuals
2015-08-16 19:04:38 -07:00
David Tolnay
a12b9102c7
Fix examples in 1.4 manual
2015-08-16 19:01:32 -07:00
David Tolnay
b5f8cb2126
Fix spelling of getpath and setpath in manual
2015-08-16 18:43:12 -07:00
David Tolnay
31be4a0495
Remove duplicate author
...
They seem to be the same person based on this pull request:
https://github.com/stedolan/jq/pull/80
I am keeping the email tied to his GitHub account.
2015-08-16 18:41:00 -07:00
David Tolnay
e785a17a5f
Sort authors
2015-08-16 18:41:00 -07:00
Nicolas Williams
b6e3657eda
Document getpath/setpath
2015-08-16 20:32:01 -05:00
David Tolnay
ec7c3cf9a7
Fix -Wzero-length-array
2015-08-16 09:11:23 -07:00
David Tolnay
eb2fc1d27e
Fix unnecessary use of BLOCK macro
2015-08-16 09:01:35 -07:00
David Tolnay
73b9e8dc99
Fix -Wgnu-zero-variadic-macro-arguments
2015-08-16 09:00:31 -07:00
David Tolnay
490a843947
Add sha1sum for jq-osx-amd64 1.5
2015-08-16 08:46:22 -07:00
David Tolnay
6fa1300d39
Link to 1.5 binary for OS X ( fix #912 )
2015-08-15 23:44:41 -07:00
David Tolnay
ef0fb50c1c
Fix 1.5 manual title
2015-08-15 23:19:13 -07:00
David Tolnay
3608341c53
Update website for jq 1.5 ( fix #910 )
2015-08-15 23:12:31 -07:00
David Tolnay
461f04bd4d
Rename header template to navbar
...
To avoid the confusing similarity between _head and _header.
2015-08-15 14:15:19 -07:00
David Tolnay
161a6fa635
Update gems
...
I updated some of these gems for a different project, and
suddenly `rake build` was giving very different output
compared to the current gh-pages. This commit makes sure
everyone updating gh-pages is using reasonably similar
versions, so we avoid spurious diffs.
2015-08-15 13:23:19 -07:00
David Tolnay
6d2f917a3a
Move footer content into template
...
This caused problems because liquid >=3.0.0 does not allow a
variable and a template with the same name. Here we had a
variable and a template both called footer.
2015-08-15 13:03:33 -07:00
David Tolnay
8f55d6d4ab
Use https where possible
2015-08-15 12:23:16 -07:00
David Tolnay
2306795864
Canonical URL and redirect to https site ( fix #908 )
2015-08-15 12:23:13 -07:00
David Tolnay
e0eb03b96d
Update website footer links
2015-08-14 11:29:47 -07:00
David Tolnay
b1083ab367
Use entry title without whitespace as section id
2015-08-14 00:33:55 -07:00
David Tolnay
e3e7cea177
Fix some w3c validator complaints
2015-08-14 00:01:49 -07:00
David Tolnay
d36a85a369
Consistent indentation of shared templates
2015-08-13 23:08:52 -07:00
David Tolnay
bd46a5dd52
Move all javascript to end of body
2015-08-13 23:00:54 -07:00
David Tolnay
7f87785002
Group logically related parser rule names
2015-08-13 22:39:31 -07:00
David Tolnay
0f419563ea
Remove all trailing whitespace
2015-08-13 22:39:23 -07:00
David Tolnay
aff6f49990
Tiny margin on tutorial accordions
2015-08-13 22:18:01 -07:00
David Tolnay
58a053d7de
Fix memory leak in non-constant module declaration
2015-08-13 21:42:35 -07:00
David Tolnay
7b5c6a9224
Fix assert fail on invalid import path ( fix #899 )
2015-08-13 21:42:35 -07:00
David Tolnay
5479d7f2dc
Fix assert fail on non-object import metadata ( fix #900 )
2015-08-13 21:42:35 -07:00
Nicolas Williams
a5b2c55a70
Fix streaming docs errors ( fix #904 )
2015-08-13 23:38:14 -05:00
Nicolas Williams
b119853aef
Test main.c fix for #817
2015-08-13 09:08:37 -07:00
Nicolas Williams
5d08d54636
Make search path expansion portable ( fix #817 )
...
This is part 2 of the fix to #817 . Part 1 is the previous commit.
2015-08-13 09:08:37 -07:00
Nicolas Williams
10df52efed
Make all global module paths absolute ( fix #817 )
...
This is part 1 of the fix for #817 . The next commit is part 2.
2015-08-13 09:08:37 -07:00
David Tolnay
68f84659f3
Update site from bootstrap 2.1.1 to 3.3.5
2015-08-13 01:10:16 -07:00
David Tolnay
3ef92863f2
Update wording and json bodies in tutorial
2015-08-11 22:02:53 -07:00
pkoppstein
dea7868f01
spelling corrections; untabify
2015-08-11 20:54:03 -07:00
pkoppstein
16d0e528aa
walk/1
2015-08-11 20:54:03 -07:00
Nicolas Williams
c426d494f0
Improve assignment docs (see #897 )
2015-08-11 18:05:22 -05:00
Nicolas Williams
9a3f802d20
Fix #896 , double-free in setpath
2015-08-11 17:46:15 -05:00
David Tolnay
89897b4bcd
Change index page links to github releases
2015-08-08 10:35:18 -07:00
David Tolnay
f1d1fea467
Add SHA-1 checksums of release binaries ( fix #726 )
2015-08-08 01:19:39 -07:00
David Tolnay
e404a1a96d
Script to update gh-pages from master
2015-08-08 00:29:22 -07:00
David Tolnay
b23d07875e
Remove obsolete gitignore entry
2015-08-08 00:26:32 -07:00
David Tolnay
9a68905228
Replace jq-1.4 source tarball link
2015-08-07 22:53:48 -07:00
David Tolnay
486c275885
Replace website download links with github releases
2015-08-07 22:23:08 -07:00
David Tolnay
a864e848b5
Add jq-1.5rc2 to index page news
2015-08-07 22:11:09 -07:00
David Tolnay
a4dc312eff
Break long line on index page
2015-08-07 22:09:06 -07:00
David Tolnay
765f9ac74c
Clean up download page and fix links
2015-08-07 21:40:19 -07:00
David Tolnay
3fae608b65
Copy over links to 1.5rc2 from gh-pages
2015-08-07 20:35:41 -07:00
David Tolnay
a47b32999b
Fix range(value;stream) ( fix #886 )
2015-08-06 23:05:03 -07:00
pkoppstein
d66fbd218b
Clarify documentation of STRING * INTEGER
2015-08-04 21:40:16 -04:00
Nicolas Williams
b5edbf7ffa
OS X's mktemp -d requires template ( fix #876 )
2015-07-28 00:28:54 -05:00
Nicolas Williams
6b55baa00f
Add missing files ( fix #875 )
2015-07-28 00:09:46 -05:00
Nicolas Williams
7f251344b7
Fix make dist ( fix #870 )
2015-07-26 23:26:30 -05:00
David Tolnay
21309bc6d7
Error on bytecodes longer than 0xFFFF ( fix #269 )
...
This lets us use uint16_t for the program counter. JVM
languages have the same limit on method size so it is a
reasonable limit.
2015-07-26 16:19:20 -07:00
David Tolnay
8295baf284
Drop plus from "jq 1.5+" on download page
...
See https://github.com/stedolan/jq/issues/488#issuecomment-124998113
2015-07-26 09:37:34 -07:00
David Tolnay
ec84f28630
News is not THIS important
2015-07-26 01:27:14 -07:00
David Tolnay
701a47c82e
Add 1.4 and 1.3 manuals to website ( fix #866 )
2015-07-26 01:26:13 -07:00
David Tolnay
616f365e5a
Suggest --disable-maintainer-mode on download page
2015-07-25 23:44:52 -07:00
David Tolnay
ceb2684f2f
Update setup.sh script
...
Adjust what gets cleaned up now that ChangeLog and
config/.gitignore are checked into the repo, and skip
install and distcheck steps.
2015-07-24 23:26:47 -07:00
David Tolnay
b9c340a211
Change homepage .com -> .io
...
The .com redirects to .io, but might as well have the
correct one to begin with.
2015-07-24 22:55:58 -07:00
David Tolnay
3a964e2025
Change AC bug-report parameter to point to GitHub
...
This affects where `make check` tells you to report failures.
2015-07-24 22:48:03 -07:00
Santiago Lapresta
3d49fc59dd
Implement flatten/0 in terms of flatten/1
2015-07-24 21:55:43 -07:00
David Tolnay
16e8d0b1ab
detect invalid path expression ( fix #862 )
2015-07-24 20:23:07 -07:00
pkoppstein
5856a2d2c0
simplify implementation of bsearch to use "until" and avoid "last"; tested
2015-07-24 12:29:20 -07:00
David Tolnay
227f62e013
Rebuild jq.1.prebuilt
2015-07-24 09:01:21 -07:00
Evan Zacks
89244cc3ea
fix references to --color-output
2015-07-24 10:18:12 -04:00
Thomas R. Hall
3a43e2ff07
Updated v1.3 filenames
...
The jq 1.3 filenames for Windows are jq-1.3.exe instead of jq.exe. Updated these so they no longer return a 404.
2015-07-23 22:24:39 -07:00
David Tolnay
81f328f1aa
Copy over changes made to gh-pages directly
...
This includes the following commits from the gh-pages branch:
- 63e80b8
- d24a397
- 9796cd6
- ee21707
- ccb0f1d
- 200e6b3
- 64134c0
- 57152d2
- 8ffbfa3
2015-07-23 21:51:30 -07:00
David Tolnay
f5a7bba986
Resolve remaining shift/reduce conflicts involving '?'
...
By lowering the precedence of rules that should never use
the generic Exp '?' rule.
2015-07-19 09:43:10 -07:00
David Tolnay
66ef8e2c24
Resolve shift/reduce conflict of 'def' vs '|'
...
This was an important conflict. In the following expression:
def a: 0; . | a
Bison needs to decide between these two equally valid
parses:
(def a: 0; .) | a
def a: 0; (. | a)
For jq we want the second one, because the first results in
"a/0 is not defined". In the current parser the first parse
is a reduce and the second parse is a shift. Since Bison
prefers to shift in shift/reduce conflicts, we accidentally
got the correct behavior.
This commit adds a precedence level FUNCDEF which is lower
precedence than '|', meaning we explicitly choose the
correct parse.
Of course many unit tests already cover this case, but I
added one specifically for it.
2015-07-19 09:42:01 -07:00
David Tolnay
1628bbf95f
Clean up trailing whitespace
2015-07-19 09:38:50 -07:00
Nicolas Williams
812703139c
Use =, not ==, for shell tests
2015-07-18 21:12:08 -05:00
David Tolnay
54add5ac9a
travis has whitelisted libonig-dev
...
https://github.com/travis-ci/travis-ci/issues/4123
2015-07-10 13:21:00 -07:00
Nicolas Williams
f183b57ed5
input_filename should never empty
2015-07-10 12:32:11 -05:00
Nicolas Williams
dc4dfdff17
Update AUTHORS
2015-07-10 12:28:21 -05:00
Nicolas Williams
f55034d314
Update NEWS
2015-07-10 11:26:29 -05:00
Nicolas Williams
930899e12d
Update ChangeLog
2015-07-10 11:12:24 -05:00
Nicolas Williams
579518c78d
Use include for import into namespace
2015-07-10 10:19:33 -05:00
Nicolas Williams
fa45a5121c
Simplify import docs
2015-07-10 10:11:30 -05:00
Nicolas Williams
862566a48f
Fix typo in docs
2015-07-10 10:10:28 -05:00
James Andariese
f9f4d2d1e5
Dockerfile reorganized
...
* Remove excess layer creation
This is an antipattern in Docker.
* Remove build tools once build is complete
Leaving them around is not necessary and expands the image size 5x
* Make check works with libonig installed
* Compiles statically (needs libonig to be built rather than installed)
* Valgrind doesn't work with the use of TLS in jq so it's disabled -- this
might be a FIXME situation; I'm not familiar enough with valgrind to
say whether this is expected
* Make entrypoint be the jq binary so that the image can also be used
to run jq in environments where you don't want to or can't install
jq (such as CoreOS).
2015-07-10 07:15:44 -07:00
Mike Fletcher
b74379532d
Fixing missing D in LIBM_DDD_NO macro name
2015-07-09 14:59:37 -04:00
David Tolnay
1e5e0c9fe2
Make jq.h usable from C++
...
Previously, with clang++:
jq.h:46:37: error: typedef redefinition with different
types ('struct jq_util_input_state *' vs 'jq_util_input_state')
With g++:
jq.h:46:37: error: conflicting declaration
‘typedef struct jq_util_input_state* jq_util_input_state’
This typedef was added to libjq by commit 0d41447 which was
after the 1.4 release, so although it is a public API, this
is not a backcompat break because it has never been in a
release.
Specifying the "*" at all uses of jq_util_input_state is
slightly tedious, but jq_state already works that way, so at
least it will be consistent.
2015-07-04 15:08:01 -07:00
Nicolas Williams
05899f8b3e
Fix Windows build
2015-07-04 13:45:24 -05:00
Nicolas Williams
a2a6f2d896
Document math support
2015-07-03 21:19:01 -05:00
Nicolas Williams
1c350c67d7
Remove pow10 for now; CHECK_MATH_FUNC needs work
...
The CHECK_MATH_FUNC() m4 macro needs work. It should use
AC_RUN_IFELSE(), not just AC_LINK_IFELSE(), and it should #define
_GNU_SOURCE and/or other such feature macros in the prologue to get
non-standard math functions (alternatvely jq should only support
standard math functions).
2015-07-03 21:13:13 -05:00
David Tolnay
2348b7245e
docs and diagram for exec_stack
2015-07-02 23:58:07 -07:00
David Tolnay
6e27de4f74
strftime wrong day-of-week ( fix #838 )
2015-07-01 20:37:16 -07:00
Nicolas Williams
e5dafaea44
Document --run-tests
2015-06-28 13:57:02 -05:00
Nicolas Williams
fd4f4f2087
Make --run-tests' jv_test() quiet
2015-06-28 13:39:32 -05:00
Nicolas Williams
6c89186437
Make --run-tests less verbose by default
...
Adding --debug-trace or --debug-dump-disasm before --run-tests now makes
it verbose.
2015-06-27 23:31:44 -05:00
Nicolas Williams
32c4759e6b
Add more basic number tests
2015-06-27 23:15:16 -05:00
Nicolas Williams
6366cfd7a4
Add pow, better libm detection ( fix #443 )
2015-06-27 23:14:46 -05:00
David Tolnay
9985c01975
gcov exclusions
2015-06-27 14:48:13 -07:00
David Tolnay
e6371712ff
flag to enable gcov and coveralls
2015-06-27 11:25:01 -07:00
David Tolnay
d7e35101c5
add configure option to run tests without valgrind
2015-06-27 11:24:53 -07:00
Nicolas Williams
1defaa7b00
Fix braino in merging the previous commit
...
There's a mantest that shows how to use `env`. Well, we need to set the
env var as expected then, else it will fail.
2015-06-27 13:00:41 -05:00
David Tolnay
815b4c9772
get Travis CI working
2015-06-27 12:40:01 -05:00
Nicolas Williams
aaf305868c
Restore import into caller's namespace
2015-06-26 23:40:37 -05:00
Nicolas Williams
8cc31f0f49
Slight re-phrasing of module docs
2015-06-26 23:38:24 -05:00
Nicolas Williams
a011ac6392
Use set -u in tests/setup
2015-06-26 23:36:34 -05:00
Nicolas Williams
505e23124f
Fix #830
2015-06-26 21:24:01 -05:00
Nicolas Williams
e7f6d1e6d0
Update Adavanced section of manual
2015-06-26 21:19:29 -05:00
Nicolas Williams
a220482de6
Document {$var}
2015-06-26 21:18:58 -05:00
Nicolas Williams
e16bd17571
Add {$var} . as {$var} syntax ( fix #831 )
2015-06-26 20:45:14 -05:00
Nicolas Williams
25d47ca08e
Add streaming utilities ( fix #827 )
2015-06-26 20:45:06 -05:00
Nicolas Williams
5108a451ca
Alternative implementation of tovalues
2015-06-26 20:17:02 -05:00
Santiago Lapresta
ec7647c4ab
Add combinations/0 and combinations/1
2015-06-23 10:59:58 -05:00
Nicolas Williams
8aecf82bfe
WriteFile() on WIN32 when stdout isatty ( fix #824 )
...
Use WriteFile() and bypass stdio IFF stdout isatty and we're on Windows.
2015-06-22 20:47:47 -05:00
Nicolas Williams
10cbb9b580
Fix test failure introduced by previous commit
2015-06-22 18:32:28 -05:00
David Tolnay
4a316fbb5a
fix errors flagged by clang static analyzer
...
builtin.c: bug - free of uninitialized jv
compile.c: missing assertion
jq_test.c: buggy logic / unreachable code
jv.c: missing assertion
jv_alloc.c: false positive - intentional read of uninitialized memory
jv_file.c: dead code
2015-06-20 16:08:56 -05:00
Nicolas Williams
7811ef1e17
Fix #811 : use CommandLineToArgvW() and _wfopen()
2015-06-19 18:54:44 -05:00
David Tolnay
b04cd6aada
fix use after free in f_strptime
2015-06-19 00:34:27 -05:00
David Tolnay
1146b8b84a
separate jq, oniguruma, sh, and man tests
2015-06-18 23:55:43 -05:00
Nicolas Williams
292f2d3208
argv[] may not be UTF-8 ( fix #811 )
2015-06-18 21:31:22 -05:00
Doug Luce
3cbefde376
Add alloca() discovery to configure.ac
...
The build failed on FreeBSD as there is no alloca.h. This patch is
lifted from the autoconf documentation.
2015-06-18 19:19:15 -05:00
Nicolas Williams
0b42457929
Fix finites
2015-06-18 10:14:52 -05:00
David Tolnay
51a81c96f1
fix broken tests in manual.yml
2015-06-18 00:06:52 -05:00
Nicolas Williams
6083581fea
Fix #802
2015-06-18 00:03:46 -05:00
Nicolas Williams
164b877bfa
Add isnormal and related, rename *inf
2015-06-17 23:14:26 -05:00
Nicolas Williams
b9c2a326ba
Fix #814 : raise on div-0, add inf isinf nan isnan
2015-06-17 19:58:55 -05:00
Nicolas Williams
bdc1feb50e
Fix infinite loop on error in sequence parser
2015-06-17 19:58:49 -05:00
Nicolas Williams
4ef04e5b5c
Sequence parser: wait for RS on startup ( fix #687 )
...
Per-RFC7464.
2015-06-17 11:24:34 -05:00
Nicolas Williams
0f5345e515
Fix infinite loop on EOF bug
2015-06-17 11:23:58 -05:00
Aaron Peschel
c95b4a8ab4
Add Missing Makefile Dependency
...
main.c requires version.h, but there is no logic marking this dependency
in the Makefile. This commit adds the dependency to the Makefile
template.
2015-06-09 19:01:20 -05:00
Nicolas Williams
520b429ca0
Clarify array destructuring docs
2015-06-09 17:29:48 -05:00
David Tolnay
d3343d5113
array and object destructuring ( fix #533 )
...
`. as [$i, $j, $k] | ...`
`. as {a: $i, b: $j} | ...`
`. as [[[$i]], {a: $j}] | ...`
`foreach . as [$i, $j, $k] (...)`
`reduce . as {a: $i, b: $j} (...)`
2015-06-09 17:29:48 -05:00
cdnbacon
2e96fb2c9b
Remove extension from links
...
The downloads are available without an extension.
2015-06-08 21:30:40 -05:00
Nicolas Williams
24a5e5b1b1
Add --tab and -indent n options
2015-06-03 20:20:11 -05:00
Nicolas Williams
74ecb88935
Improve usage message
2015-05-29 15:35:30 -05:00
Nicolas Williams
33874eb513
Fixup --slurpfile/argile docs
2015-05-29 15:25:30 -05:00
Nicolas Williams
1de56bc5df
Add --slurpfile
2015-05-29 14:24:33 -05:00
Nicolas Williams
8a79f1d0a3
Better handling of stdout errors
2015-05-29 11:50:08 -05:00
Nicolas Williams
f4f5d8882d
Fix --argfile memleak ( fix #799 part 2)
2015-05-29 11:49:45 -05:00
Nicolas Williams
4451c08007
Fix jv_load_file() (partial fix #799 )
2015-05-29 11:48:10 -05:00
Nicolas Williams
89c57f7936
Revert "Fix #705 (--argfile weirdness)"
...
This reverts commit 3d2ab93b11 .
2015-05-29 10:38:08 -05:00
Nicolas Williams
6af7857ccd
Revert "Better argfile fix ( #705 , fix #736 )"
...
This reverts commit 4f8567476d .
2015-05-29 10:37:58 -05:00
Nicolas Williams
dff96aebcf
Add jv_mem_strdup*() and callocs too
2015-05-25 21:20:37 -05:00
Nicolas Williams
8af52aaf52
Add ./configure --enable-all-static instead
2015-05-25 21:19:56 -05:00
Nicolas Williams
d66e434fb4
Always add -all-static when --enable-static
2015-05-25 14:14:53 -05:00
Nicolas Williams
3700b457aa
Update parser.c
2015-05-25 13:35:23 -05:00
Nicolas Williams
11f084f9a7
Keywords should be OK as object keys ( fix #794 )
...
With this change it's now OK to use keywords as object keys like so:
{if:0}
2015-05-25 13:34:07 -05:00
Nicolas Williams
454a9dc042
Fix Windows build: util.c
2015-05-25 02:06:44 -05:00
Steven Penny
ff458803ce
Fix #793
2015-05-25 02:05:07 -05:00
Travis Gockel
110e009996
Add wrapping and clamping to jv_array_slice
...
Fix #716 . Fix #717 .
2015-05-21 19:17:16 -05:00
Assaf Gordon
7b6a018dff
Print offending object in runtime error messages
...
When reporting an error to the user, add information about the offending
object/value (possibly truncated).
The goal is to give a user some context regarding which input object
caused the runtime error.
Examples:
$ echo '"hello"' | ./jq '-.'
jq: error: string ("hello") cannot be negated
$ echo '"very-long-string"' | ./jq '-.'
jq: error: string ("very-long-...) cannot be negated
$ echo '["1",2]' | ./jq '.|join(",")'
jq: error: string (",") and number (2) cannot be added
$ echo '["1","2",{"a":{"b":{"c":33}}}]' | ./jq '.|join(",")'
jq: error: string (",") and object ({"a":{"b":{...) cannot be added
$ echo '{"a":{"b":{"c":33}}}' | ./jq '.a | @tsv'
jq: error: object ({"b":{"c":33}}) cannot be tsv-formatted, only array
(Fix #754 )
2015-05-21 18:49:24 -05:00
Nicolas Williams
a50e548cc5
Fix error message for @tsv
2015-05-21 18:20:15 -05:00
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
c7f063188f
Fix formatting error in manual.yml
2015-05-21 00:11:21 -05:00
Assaf Gordon
a6460f4fe2
Report filename:line on runtime errors ( fix #752 )
...
With this patch, jq run-time errors printed to stderr will contain the
filename and line of the offending input.
But note that the JSON text parser does (yet) print the input filename
on parse error. A jq run-time error is a jq program error, not
including syntax errors nor JSON text input format errors.
Examples:
With stdin and multiple lines:
$ printf '{"a":43}\n{"a":{"b":66}}\n' | ./jq '.a+1'
44
jq: error (at stdin:2): object and number cannot be added
With multiple files:
$ printf '{"a":43}' > 1.json
$ printf '{"a":"hello"}\n' > 2.json
$ printf '{"a":{"b":66}}\n' > 3.json
$ ./jq '[.a]|@tsv' 1.json 2.json 3.json
"43"
"hello"
jq: error (at 3.json:1): object is not valid in a csv row
With very long lines (spanning multiple `fgets` calls):
$ ( printf '{"a":43}\n' ;
printf '{"a":{"b":[' ; seq 10000 | paste -d, -s | tr -d '\n' ;
printf ']}}\n' ;
printf '{"a":"hello"}\n' ) | ./jq '[.a] | @tsv'
"43"
jq: error (at stdin:2): object is not valid in a csv row
"hello"
With raw input:
$ seq 1000 | ./jq --raw-input 'select(.=="700") | . + 10'
jq: error (at stdin:700): string and number cannot be added
Caveat:
The reported line will be the last line of the (valid) parsed JSON data.
Example:
$ printf '{\n"a":\n"hello"\n\n\n}\n' | ./jq '.a+4'
jq: error (at stdin:6): string and number cannot be added
2015-05-20 23:38:22 -05:00
Nicolas Williams
2e257563a6
Fix spelling
2015-05-20 10:21:30 -05:00
Nicolas Williams
ad0090964b
Document gsub/3
2015-05-19 01:19:51 -05:00
Nicolas Williams
cbdaeb4062
Fix gsub, add gsub/3 ( fix #782 )
2015-05-18 23:02:11 -05:00
Nicolas Williams
cf1306f469
Add -all-static when --enable-static
2015-05-18 12:07:29 -05:00
Nicolas Williams
7675f7434a
Fix --stream assertion
2015-05-11 21:36:47 -05:00
Nicolas Williams
821d6404b6
Add error injection library
2015-05-11 21:36:46 -05:00
Nicolas Williams
e3cb1f76cd
Report read errors too (and fix #772 )
2015-05-11 21:36:26 -05:00
Nicolas Williams
ef12efbf8c
Fix README
2015-05-02 17:36:37 -05:00
Nicolas Williams
adb9b9b8a7
README: send questions to SO and Freenode
2015-05-02 17:34:59 -05:00
Nicolas Williams
07f94f82a2
usage() should check fprintf() result ( fix #771 )
2015-04-28 10:39:34 -05:00
Nicolas Williams
215b4c0fe1
Use jv_mem_alloc() in compile.c ( fix #771 )
2015-04-28 10:37:37 -05:00
Nicolas Williams
89963e1370
Fix header guards ( fix #770 )
2015-04-28 10:36:21 -05:00
Nicolas Williams
5d40f3a7c0
--raw-input wrongly adds NULs ( fix #761 )
2015-04-24 10:42:19 -05:00
Nicolas Williams
5e0e7a7ebd
With inputs builtin, -n and -R can now coexist
2015-04-23 23:43:44 -05:00
Nicolas Williams
dad6e42934
--raw-input ought to read NULs (partial fix #760 )
...
We can't know how many bytes fgets() read when we reach EOF and fgets()
didn't see a newline; we can only assume that at least strlen(buf) bytes
were read. This is quite obnoxious if one wants to use NULs in raw
input, but at least we can make reading "a\0b\0c\0" with no newline
yield "a\0b\0c", losing only the final sequence of NULs.
We can't use getline() either, since it will want to allocate a buffer
big enough for an entire line, and we might not have any newlines in our
input. A complete fix will have to use getc() or read(), preferably the
latter.
2015-04-23 23:43:44 -05:00
Nicolas Williams
7d938487dd
--slurp --raw-input is broken ( fix #761 )
2015-04-23 18:26:57 -05:00
Nicolas Williams
fcfacb932d
from_entries is broken ( fix #767 )
2015-04-23 18:25:32 -05:00
Assaf Gordon
6906d291c5
regex functions: report informative error if not available.
...
When trying to use the new regex functions (match/test/sub/capture/etc)
in a JQ that was compiled without the ONIGURAMA regex library,
report an informative error message instead of a 'not defined' error.
Before:
$ echo '"foo"' | ./jq-old 'test("foo")'
jq: error: test/1 is not defined at <top-level>, line 1:
test("foo")
jq: 1 compile error
After:
$ echo '"foo"' | ./jq 'test("foo")'
jq: error: jq was compiled without ONIGURAMA regex libary. match/test/sub and related functions are not available.
2015-04-22 16:57:03 -05:00
Andrew O'Brien
943090846f
Fixes manual generation with psych
...
When running `make` I ran into a couple of problems building the manual. While
I'm not entirely sure that this is the root cause, it appears to have been
related to the fact that ruby 2.0 dropped syck completely in favor of psych
(which was introduced in 1.9.2) for YAML processing. I'm currently using ruby
2.1.0p0.
I'm assuming that the fact that the YAML engine was explicitly set to syck in
the Rakefile was an attempt to work around some incompatibility between the two
libraries, so I looked into what would be necessary to get it to work with the
newer one. The changes to `manual.yml` ended up being pretty minor: I ran it
through `iconv` to convert some ISO-8859-1 characters to UTF-8 and added some
quotes in places (apparently you can't start a string value with '`').
2015-04-22 11:01:39 -05:00
Assaf Gordon
2dc8621d05
Handle NUL in escaped-string output
...
When escaping string (e.g. for `@tsv` or `@csv` outputs),
escape NULs as '\0'.
Existing behaviour, unchanged by this patch:
$ echo '"a\u0000b"' | ./jq '.'
"a\u0000b"
$ echo '"a\u0000b"' | ./jq -r '.' | od -a
0000000 a nul b nl
0000004
When using `@tsv`, escape NUL to `\0`:
$ echo '"a\u0000b"' | ./jq -r '[.]|@tsv'
a\0b
$ echo '"a\u0000b"' | ./jq '[.]|@tsv'
"a\\0b"
2015-04-20 16:51:48 -04:00
tal@whatexit.org
b6cc00fa71
manual.yml: Clarify how to specify keys with ":" and special chars.
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2015-04-16 11:09:49 -05:00
Assaf Gordon
9e2d9b6419
docs: expand @tsv section - add escape sequences.
2015-04-15 23:24:24 -04:00
Assaf Gordon
3210b29bba
@tsv: escape \r, \n, \\
...
When using '@tsv' output format with '-r' option,
escape \r, \n and \\ in addition to \t.
Example:
$ printf '{"id":"hello\\ttab\\nworld","x":43 }' | jq .
{
"id": "hello\ttab\nworld",
"x": 43
}
Before: newlines are not escaped, generating invalid TSV output:
$ printf '{"id":"hello\\ttab\\nworld","x":43 }' \
| ./jq-old -r '[.id,.x] | @tsv'
hello\ttab
world 43
After: newlines are properly escaped:
$ printf '{"id":"hello\\ttab\\nworld","x":43 }' \
| ./jq-new -r '[.id, .x] | @tsv'
hello\ttab\nworld 43
Before: backslashes themselves are not escaped, so there's no way to
distinguish between escaped characters and 'real' backslashes
(in the example below, there is should not be newline, despite the
output containing "\n".
$ printf '{"x":"hello\\ttab\\\\new world"}' \
| ./jq-old -r '[.x]|@tsv'
hello\ttab\new world
After: backslashes are escaped:
$ printf '{"x":"hello\\ttab\\\\new world"}' \
| ./jq-new -r '[.x]|@tsv'
hello\ttab\\new world
2015-04-15 16:11:58 -04:00
Nicolas Williams
ddad9618dc
Test fix for mktime
2015-03-31 10:03:35 -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
7d6d4066dd
Tweak fix for #719
2015-03-24 15:05:06 -05:00
Assaf Gordon
4c22bda09b
detect and report output writing errors
...
Detect output errors when the program exits.
Currently:
$ echo '{}' | jq . > /dev/full && echo ok
ok
with the patch:
$ echo '{}' | jq . > /dev/full && echo ok
Error: writing output failed: No space left on device
also apply to hardware/network/other I/O errors.
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2015-03-24 15:01:32 -05:00
Santiago Lapresta
9d62c6fd0c
Adds Dockerfile
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2015-03-24 14:59:29 -05:00
Assaf Gordon
5e0db6dd65
partial handling of input errors
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2015-03-24 14:56:46 -05:00
Assaf Gordon
551d875be1
always propagate input errors to exit code
...
Improve robustness in automated system when using exit code in shell scripts,
by exiting with code 2 if there was any input error (even overriding other
possible error exit codes).
Exit code 2 is already used to indicate system errors.
Without the patch:
$ jq . no-such-file ; echo $?
jq: no-such-file: No such file or directory
0
With the patch:
$ jq . no-such-file ; echo $?
jq: no-such-file: No such file or directory
2
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2015-03-24 14:55:14 -05:00
Nicolas Williams
4f8567476d
Better argfile fix ( #705 , fix #736 )
2015-03-24 14:53:35 -05:00
Nicolas Williams
ffa2832e33
Drop name-less label/break for now
...
See #734 and #658 .
2015-03-24 01:21:17 -05:00
William Langford
0f7759f831
Fix #735
2015-03-23 22:11:55 -04:00
Nicolas Williams
ccfba00178
Add more date builtins
2015-03-09 11:27:58 -05:00
Nico Williams
3e8183fcd5
Merge pull request #720 from agordon/exit-code-5-exceptions
...
exit with non-zero code on runtime exceptions
2015-03-08 17:09:07 -05:00
Nicolas Williams
0df387f6b5
Automake: jq depends on version.h ( fix #721 )
2015-03-08 16:52:08 -05:00
Assaf Gordon
4104c4fa1c
exit with non-zero code on runtime exceptions
...
With this change, runtime exceptions are propagated to non-zero exit
code of 'jq', allow better scripting and automation. The new exit code
value is 5.
This allows using the shell's and/or operations ('&&' and '||') to
detect input runtime exceptions.
Before:
runtime exceptions are printed to STDERR, but not reported as non-zero exit-code:
$ echo '"hello"' | jq '.|tonumber' ; echo $?
jq: error: Invalid numeric literal at EOF at line 1, column 5 (while parsing 'hello')
0
After:
$ echo '"hello"' | ./jq '.|tonumber' ; echo $?
jq: error: Invalid numeric literal at EOF at line 1, column 5 (while parsing 'hello')
5
Note that there's a subtle interplay when using "-e" option.
The value of the non-zero exit code changes from 4 to 5, but it still
indicates a 'failure' or non-true value.
Before:
$ echo '"hello"' | jq -e '.|tonumber' ; echo $?
jq: error: Invalid numeric literal at EOF at line 1, column 5 (while parsing 'hello')
4
After:
$ echo '"hello"' | ./jq -e '.|tonumber' ; echo $?
jq: error: Invalid numeric literal at EOF at line 1, column 5 (while parsing 'hello')
5
2015-03-06 18:50:58 -05:00
Nicolas Williams
33a85679b9
Fix #718
2015-03-06 00:18:45 -06: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
b82c231900
Remove -i option ( #704 )
...
In-place editing should be implemented with builtins for file I/O.
2015-03-05 21:52:02 -06:00
Nicolas Williams
3d2ab93b11
Fix #705 (--argfile weirdness)
2015-02-18 18:38:11 -06:00
Nicolas Williams
c86ef36769
Test in-place functionality; fix #704
2015-02-18 18:01:12 -06:00
Nicolas Williams
3b8d08177f
Fix #702
2015-02-18 10:21:21 -06:00
Nico Williams
0164ff0bbc
Merge pull request #701 from sseemayer/master
...
Correct automake and autoconf version requirements
2015-02-18 10:00:23 -06:00
Stefan Seemayer
a4baac2256
Correct automake and autoconf version requirements
2015-02-18 13:15:44 +01:00
Nicolas Williams
1e5e9f3ef8
Mention --disable-maintainer-mode in bison error
2015-02-17 11:00:07 -06:00
Nico Williams
d58d85af9e
Merge pull request #699 from hroptatyr/oniguruma-detection
...
Fix oniguruma detection logic
2015-02-16 10:54:33 -06:00
Sebastian Freundt
10e8d34fd3
Fix oniguruma detection logic
...
At the moment, a failed oniguruma header check would leave
HAVE_ONIGURUMA set to 1 still, resulting in a compiler error
in builtin.c.
2015-02-16 09:01:08 +00:00
Nicolas Williams
ebc090ad15
README tweaks
2015-02-15 18:34:44 -06:00
Nicolas Williams
8cef5a37ab
Add --disable-maintainer-mode; make bison optional
...
Also flex is now optional.
The outputs of flex and bison are now committed. By default they get
built, but users who want to build from git can now
./configure --disable-maintainer-mode
to turn off the dependency on bison and flex.
Maintainers must, of course, commit the bison and/or flex outputs when
they make changes to parser.y and/or lexer.l, respectively.
2015-02-15 18:34:44 -06:00
Nicolas Williams
8afdeee785
Make Oniguruma/regexp optional
...
Tests won't pass if built without Oniguruma. We don't have a way to
make a test optional yet. That will come later. For now the ability to
reduce build-time dependencies could really help some users.
2015-02-15 18:32:01 -06:00
Nicolas Williams
a83a9e0bc2
Reduce number of msg callback typedefs
2015-02-13 15:58:02 -06:00
Nicolas Williams
0d414471bb
Refactor moar: move parts of main.c into libjq
...
This adds utility functions for reading and parsing files that should be
easy to use by other apps, together with jq_start()/jq_next().
2015-02-13 15:58:02 -06:00
Nicolas Williams
91fb3df495
Refactor handling of inputs in main() ( fix #667 )
...
Much of this could be in libjq. Eventually all of the work of reading
from files and looping over `jq_next()` should move into libjq, with
`main()` mostly doing all the command-line option processing.
2015-02-13 15:55:31 -06:00
Nico Williams
373ef71feb
Merge pull request #692 from kim-toms/enhance-from_entries
...
Enhance from_entries to better deal with Amazon AWS Tags
2015-02-10 10:49:35 -06:00
Kim Toms
ca78a746e6
Enhance from_entries to better deal with Amazon AWS Tags
2015-02-10 08:33:56 -05:00
Nicolas Williams
1e13e1e06e
Fix sequence warnings ( fix #686 )
2015-01-30 17:21:50 -06:00
Nicolas Williams
42ff8a6959
Usage message for -h should go to stdout
2015-01-30 10:27:46 -06:00
William Langford
2e92c3e568
Merge pull request #678 from isomorphisms/patch-1
...
readability
2015-01-27 14:15:07 -05:00
i
5389fdb651
readability
...
Easier to read dashes than hyphens imho.
2015-01-27 13:32:15 -05:00
Nicolas Williams
7a295b30e0
Fix --raw-input
2015-01-20 00:22:24 -06:00
Nico Williams
cca3e92854
Merge pull request #669 from joelpurra/join-empty-array-668
...
Empty arrays join/1 to an empty string, fixes #668 bug introduced by 9760245
2015-01-14 15:50:15 -06: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
aeb52e29d6
Add debug and stderr builtins
...
And refactor setup of jv dump flags.
2015-01-14 01:39:13 -06: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
d630597e87
Fix docs for split/0
2015-01-12 10:47:43 -06:00
Nicolas Williams
60d1ecb58a
Fix #552
2015-01-12 10:44:44 -06:00
Nicolas Williams
d927a2c185
Fix --run-tests arg handling
2015-01-12 10:43:06 -06:00
Nicolas Williams
6e7cf81d74
Look for jq/main.jq for imports
2015-01-02 19:16:43 -06:00
Nicolas Williams
736f1751ee
Add comments to tests/run
2015-01-02 19:15:57 -06:00
Nicolas Williams
28aab9ca79
Fix tests/run in from-tar-ball case
...
Drop useless use of scripts/version
2015-01-02 19:15:11 -06:00
Nicolas Williams
972c048149
Add static build instructions ( fix #294 )
2015-01-01 16:26:55 -06:00
Nicolas Williams
902aa39fce
Fix warning in util.c
2015-01-01 15:15:10 -06:00
Nicolas Williams
22f55aa585
Include missing EXTRA_DIST items; fix #661
2015-01-01 15:14:49 -06:00
Nicolas Williams
157c95b988
Add mkstemp() for mingw build
2015-01-01 03:14:55 -06:00
Nicolas Williams
426913f127
Fix memleak introduced run-tests enhancement
2015-01-01 02:12:08 -06:00
Nicolas Williams
c4cc62a053
Add more missing test files
2015-01-01 01:49:40 -06:00
Nicolas Williams
862696a778
Add missing test file
2015-01-01 01:39:50 -06:00
Nicolas Williams
86bc662bd2
Move some module tests into all.test
2014-12-31 20:09:53 -06:00
Nicolas Williams
ae7f8d6ab9
Further module system revamp ( fix #659 )
...
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-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
Nicolas Williams
c308b2881f
Fix parser leak (fuzzing)
2014-12-30 11:31:52 -06:00
Nicolas Williams
c959d1fca1
Fix lineno counting in jq_test.c
2014-12-30 11:28:50 -06:00
Nicolas Williams
63511a874f
Add support for testing erroneous programs
...
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)
$
2014-12-30 10:55:30 -06:00
Nicolas Williams
90c705f138
Make --run-tests more informative
...
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.
2014-12-30 10:55:30 -06:00
Nicolas Williams
b67bad82cb
Allow resetting of jq err callback
...
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.
2014-12-30 10:52:38 -06:00
Nicolas Williams
6981b46338
Fix streaming bug (fuzzing)
2014-12-30 01:35:22 -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
5df20f4954
Add debug builtin
...
And refactor setup of jv dump flags.
2014-12-27 18:25:34 -06:00
Nicolas Williams
a9c613e87d
Don't force C API users to set input cb
2014-12-27 18:15:10 -06:00
Nicolas Williams
7538ef34be
Make jq --run-tests show test line numbers
2014-12-27 18:15:10 -06:00
Nicolas Williams
5c62a4b805
Fix uninitialized struct field
2014-12-27 18:09:28 -06:00
Nicolas Williams
559863ca68
Streaming parser torture tests
2014-12-26 23:18:07 -06:00
Nicolas Williams
845ad5e969
Fuzz JSON parser
2014-12-26 23:05:57 -06:00
Nicolas Williams
243b1f8e5e
Better quoting in tests/run
2014-12-26 23:05:56 -06:00
Nicolas Williams
5bfb9781f7
Add Streaming parser (--stream)
...
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-26 23:05:56 -06:00
Nicolas Williams
906d2537b9
Allow C-coded functions to empty
...
Just return a jv_invalid() without a message.
2014-12-26 23:05:56 -06:00
Nicolas Williams
bbb287f54b
Add BLOCK_8() macro
2014-12-26 23:05:56 -06:00
Nicolas Williams
e51e916e31
Fix foreach non-progation of errors
...
Errors were being re-propagated as "break".
Also add `error/0` builtin, which made this fix easier.
2014-12-26 23:05:20 -06:00
Nicolas Williams
46e3125e26
Allow zero-length buffers in jv_parser_set_buf()
...
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).
2014-12-26 22:56:48 -06:00
Nicolas Williams
c02fcc8fef
Fix in and inside
2014-12-26 22:56:48 -06:00
Nico Williams
25d4cbd1b3
Merge pull request #624 from Janrain-Colin/patch-1
...
Doc correction
2014-12-26 22:14:17 -06:00
Nico Williams
3234a7681e
Merge pull request #366 from slapresta/inversed-contains
...
Added `in` command
2014-12-26 22:00:41 -06:00
Nico Williams
36077da66a
Merge pull request #628 from slapresta/map-on-objects
...
Modify map\1 so that it works on objects
2014-12-26 21:50:11 -06:00
Nicolas Williams
9e1fd8cf4d
Fix infinite loop in read_more() ( fix #656 )
2014-12-24 16:49:55 -06:00
Nicolas Williams
a55085b662
Fix EOF handling; fix #656
2014-12-24 16:07:36 -06:00
Nico Williams
e0f9b6a5cd
Merge pull request #651 from eiiches/fix-examples
...
Fix several errors in the manual
2014-12-24 11:29:29 -06:00
Nicolas Williams
0053aa868c
Add @tsv; fix #645
2014-12-24 11:21:18 -06:00
Nico Williams
fab2048648
Merge pull request #653 from msabramo/patch-1
...
.travis.yml: Set sudo false; use containers
2014-12-24 11:20:47 -06:00
Nicolas Williams
56ae88d9d5
Module search revamp for pkg managers
...
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.
2014-12-24 02:31:51 -06:00
Nicolas Williams
1cdcff1c01
Fix bug caused by 8ca07a0
2014-12-24 02:25:11 -06:00
Nicolas Williams
8ca07a08c3
Fix #348 : reject unescaped control chars
2014-12-24 00:01:43 -06:00
Nico Williams
2775b90b20
Merge pull request #601 from slapresta/redefine-any-all
...
Define {any,all}/0,1 in terms of {any,all}/2
2014-12-23 23:37:25 -06:00
Nicolas Williams
ae312bd7fe
Use __attribute__ __printf__ with GCC
2014-12-23 23:22:57 -06:00
Nicolas Williams
9017b83d4e
Make values faster ( fix #652 )
2014-12-23 23:22:57 -06:00
Nicolas Williams
02cf1831e9
Fix #649
2014-12-23 18:16:21 -06:00
Marc Abramowitz
d237de7b30
.travis.yml: Set sudo false; use containers
...
This is the way to enable Travis's fancy new containers, which should result in faster builds.
2014-12-22 21:37:23 -08:00
Santiago Lapresta
84d3203dd1
Define map_values
2014-12-22 23:05:35 +01:00
Santiago Lapresta
a3234034b5
in is now inside, added in as inverse of has
2014-12-22 22:17:53 +01:00
Santiago Lapresta
b748eae035
Added in command
2014-12-22 22:14:06 +01:00
Eiichi Sato
a6656edc7c
Fix examples in manual
2014-12-21 03:26:04 +09:00
Eiichi Sato
b4a9ea56ae
Fix indents in manual.yml
2014-12-21 03:24:45 +09:00
Eiichi Sato
fdbc91e3c4
HTML-escape jq programs in manual
2014-12-21 03:24:41 +09:00
Eiichi Sato
bd67bb8273
Fix examples in manual
2014-12-21 03:24:38 +09:00
Nico Williams
54a0470c42
Merge pull request #611 from StevenMaude/tutorial-typo-fixes
...
Fix typos in tutorial
2014-12-12 17:46:17 -06:00
Nico Williams
3dd790c408
Merge pull request #616 from ianmiell/ianmiell_requirements
...
Requirements made slightly more complete
2014-12-12 17:45:17 -06:00
Nicolas Williams
be11b2768f
Add until(cond; next); fix #639
2014-12-12 17:35:59 -06:00
Nicolas Williams
2075bec60f
Fix #647 , but caused by 89791a0
2014-12-12 17:05:16 -06:00
Nicolas Williams
44c2382402
Add --argjson, fix #648
2014-12-12 16:40:07 -06:00
Nico Williams
fd041c2064
Merge pull request #642 from Janrain-Colin/patch-3
...
fix typo in manual
2014-12-12 16:03:18 -06:00
Colin von Heuring
c6495f6632
fix typo in manual
2014-12-06 16:27:43 -08:00
Nicolas Williams
7243989c52
Fix refcount leak, fix #618
2014-11-29 15:24:43 -06:00
Nicolas Williams
46613af64c
STOREV/LOADV* should also print refcnts
2014-11-28 20:52:22 -06:00
Nicolas Williams
79000644c6
Enable printing of stack val refcnts
2014-11-28 19:35:29 -06:00
Nicolas Williams
b349e7d9a8
Print stack value refcounts when tracing ( #636 )
2014-11-28 19:26:41 -06:00
Colin von Heuring
6c8882caf3
Doc correction
2014-11-23 11:37:50 -08:00
William Langford
30e00820a7
Fix #600 . Add regression test
2014-11-12 20:46:34 -05:00
Ian Miell
0f81e1bcd0
Requirements made slightly more complete: cf https://github.com/ianmiell/shutit/blob/master/library/jq/jq.py
2014-11-11 23:02:31 +00:00
Steven Maude
cb376b27f8
Fix typos in tutorial
...
parrent > parent, url > URL
2014-11-05 10:47:37 +00:00
Santiago Lapresta
dc5e77ef8e
Define {any,all}/2 independently from {any,all}/0
2014-10-21 13:00:38 +02:00
Santiago Lapresta
72735167f9
Define {any,all}/{0,1} in terms of {any,all}/2
2014-10-20 22:01:25 +02:00
Nicolas Williams
89791a000b
Add support for JSON sequence MIME type
...
Per draft-ietf-json-text-sequence-07 (which soon will be published as an
RFC).
2014-10-12 08:44:40 -05:00
William Langford
3411167c03
Properly call onig_error_code_to_str
...
Fix #585
2014-10-06 21:48:56 -04: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
07d8d5c5ef
Update docs about sort/group/min/max/unique
2014-10-03 17:58:44 -05:00
Nicolas Williams
0b29b44cab
from-entries should work with EC2 ( fix #592 )
2014-10-03 17:47:13 -05:00
Nicolas Williams
a0a350f468
Remove sort/1 and group/1
...
Reserve these for sorting with jq-coded comparators.
2014-10-03 17:47:13 -05:00
Nicolas Williams
4a57b84db0
to_entries should not sort keys ( fix #561 )
2014-09-30 21:52:30 -05:00
William Langford
f7a2af7052
Properly handle when objects cannot be folded
...
Fix #579 .
2014-09-22 20:14:46 -04:00
Nicolas Williams
456bafa82f
Drop the jq version directory from search path
2014-08-30 00:58:24 -05:00
Nicolas Williams
7a8e3c759e
Never close stdin; allow multiple - arguments
2014-08-30 00:40:03 -05:00
Nicolas Williams
b70bea8d34
Handle invalid inputs in argument files ( fix #562 )
2014-08-30 00:40:03 -05:00
William Langford
d177944b75
Properly handle incomplete json when input is file
...
Fix #562
2014-08-28 21:52:45 -04:00
Nicolas Williams
9bd55487ea
C-coded builtins should not assert ( fix #553 )
2014-08-21 00:12:29 -05:00
Nicolas Williams
23e2e2eab3
Quiet warning about freopen() of stdout
2014-08-20 20:49:30 -05:00
Nicolas Williams
8d2d5e37e5
Drop "any/" in module search; use 1.x-master
2014-08-20 20:48:48 -05:00
Nicolas Williams
287e2c96ed
BSD sed lacks -r; fix #551
2014-08-14 03:31:25 -05:00
Nicolas Williams
f8d9478517
Document module system
...
Fix #511 .
2014-08-14 03:26:28 -05:00
Nicolas Williams
1ba8c2cfa6
Add module directive, modulemeta builtin
...
Fix #425 .
2014-08-14 03:26:26 -05:00
Nicolas Williams
d654724fef
Add JV_OBJECT() macro
2014-08-14 03:21:38 -05:00
Nicolas Williams
3375089013
Add JV_ARRAY() macro
2014-08-14 03:21:38 -05:00
Nicolas Williams
9f13afa20f
Add jq_report_error() function; use it
...
Put a stop to fprintf(stderr, ...) where we shouldn't.
2014-08-14 03:21:35 -05:00
Nicolas Williams
908c10928b
Fix #549
2014-08-11 14:58:44 -05:00
Nicolas Williams
c321c3b86b
Constant fold objects
2014-08-09 20:47:03 -05:00
Nicolas Williams
f87521183f
Fold constant arrays
2014-08-09 20:27:08 -05:00
Nicolas Williams
8a561120c4
More constant folding: null, true, and false
...
A step towards doing constant folding for arrays and objects.
2014-08-09 19:15:50 -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
4249bbf0d5
Make nwise private
2014-08-08 19:36:43 -05:00
Nicolas Williams
8a57c27e92
Make regexp builtins and range/3 use #524 too
2014-08-08 19:31:11 -05:00
Nicolas Williams
8706b6b16a
Use def f($a): ...; syntax for builtins
2014-08-08 19:23:46 -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
Nicolas Williams
eb12f0358e
Fix docs YAML (introduced in #432 )
2014-08-08 18:01:42 -05:00
pkoppstein
a696c6b551
regex filters ( #432 ): scan, splits, split, sub, gsub
2014-08-08 17:00:14 -05:00
Nicolas Williams
0d437e25de
Better error msg for bad shell quoting ( fix #538 )
2014-08-06 17:51:53 -05:00
William Langford
6744664ff4
Actually check version for bison.
...
Clean up oniguruma checks.
2014-08-06 12:26:34 -04:00
William Langford
ef5bd5a6de
Merge pull request #532 from wtlangford/top-removal
...
Remove duplicate TOP insertions, drop unused defs.
2014-08-05 13:41:59 -04:00
Nicolas Williams
2159f9f5e0
Document TCO a bit more
2014-08-05 01:15:33 -05:00
Nicolas Williams
2518b3a34f
Fix docs (missing backquotes)
2014-08-05 01:15:33 -05:00
William Langford
c3d6d5fd37
Merge pull request #523 from eproxus/patch-1
...
Add example of selecting object with keys
2014-08-05 00:50:21 -04:00
William Langford
a25950a58c
Remove duplicate TOP insertions, drop unused defs.
2014-08-05 00:46:10 -04:00
pkoppstein
f8fed0f0bc
Apply TCO to recurse/1, add recurse/2; tweak docs
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2014-08-04 21:11:01 -05:00
Adam Lindberg
89545ea9d0
Add example of selecting object with keys
...
It is not very straight forward how to select objects by their attributes from an array. This example provides the basic use case of how to select some objects based key values.
2014-08-01 12:13:35 +02:00
Nicolas Williams
a2f99d43c3
Some builtins are unnecessarily special ( fix #521 )
2014-08-01 00:20:30 -05:00
Nicolas Williams
a7878a8d1a
Correct @wtlangford's address
2014-07-30 13:19:46 -05:00
Nicolas Williams
c73ad74be0
Add @wtlangford to the AUTHORS list
2014-07-30 13:02:34 -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
William Langford
14bc1f6526
Fixing crash when a library's dependency could not be loaded.
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2014-07-27 17:51:48 -05:00
Nicolas Williams
2e2538ccb8
Fold constants ( fix #504 )
2014-07-27 17:48:49 -05:00
Nicolas Williams
ae27178352
Fix #499 , #500
2014-07-27 17:41:40 -05:00
William Langford
0f89270d08
Changing color codes to fix #495
2014-07-22 23:05:43 -05:00
Nicolas Williams
10f5a3448d
Do fix remaining bison warning ( fix #433 )
2014-07-22 22:51:11 -05:00
Nicolas Williams
50b85c2911
Rename jq_memmem() to _jq_memmem()
2014-07-22 22:51:11 -05:00
William Langford
38b939688a
Added library system with -l, -L, and JQ_LIBRARY_PATH
...
Created util.[ch] to hold common utilities.
2014-07-22 22:51:11 -05:00
Nicolas Williams
01fc8168e9
Add -i option to edit files in place ( fix #105 )
2014-07-20 00:11:23 -05:00
Nicolas Williams
3362fb3406
Add -n to short usage msg; fix --arg msg
2014-07-20 00:04:24 -05:00
Nicolas Williams
8c3d503d54
Fix bison empty rule warnings ( #433 , partial fix)
2014-07-14 16:41:48 -05:00
Nicolas Williams
2bb9fc5dda
Fix #484 , try/catch syntax has conflicts
2014-07-14 16:41:48 -05:00
Nico Williams
ea3e947b50
Merge pull request #483 from else/master
...
jq 1.4 is in Debian
2014-07-14 09:16:01 -05:00
Simon Elsbrock
538e012e85
jq 1.4 is in Debian
...
jq 1.4 is in Debian, please see https://tracker.debian.org/pkg/jq
2014-07-14 11:24:47 +02:00
Nico Williams
918ada06dc
Merge pull request #482 from mbruggmann/manual-fixes
...
Fix manual example for `endswith`.
2014-07-13 19:01:57 -05:00
Nicolas Williams
cb2737a433
Add regression test for #479
2014-07-13 19:00:37 -05:00
Nicolas Williams
c38e5b1b2c
Lib defs don't bind to each other; fix #479 again
2014-07-13 18:36:27 -05:00
Marc Bruggmann
089041b090
Fix manual example for endswith.
2014-07-13 19:02:21 +02:00
Nicolas Williams
cadf8c3cb0
Revert "Library defs don't bind to each other; fix #479 "
...
This reverts commit 6b6e3f4262 . It was
the wrong fix.
2014-07-13 02:04:27 -05:00
Nicolas Williams
6b6e3f4262
Library defs don't bind to each other; fix #479
2014-07-12 18:38:55 -05:00
Nicolas Williams
6e88d419ba
Fix #478 assertion failure
2014-07-10 19:23:02 -05:00
Nico Williams
ab4bf05300
Merge pull request #475 from qqshfox/patch-1
...
Fix examples for `del` in manual
2014-07-09 10:09:28 -05:00
Hanfei Shen
ecac7bd3a1
Fix examples for del in manual
2014-07-09 16:37:17 +08:00
Zhiming Wang
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 <nico@cryptonector.com >
2014-07-09 01:12:23 -05:00
Zhiming Wang
f68815d5ad
Add tests/all.trs to .gitignore
...
tests/all.trs is auto generated during make check.
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
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
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
Nicolas Williams
63dbac28ad
Fix typo; rename jq.1-prebuit to jq.1.prebuilt
2014-06-13 19:04:06 -05:00
Nicolas Williams
e9a1de47b4
Add env builtin
2014-06-13 17:51:41 -05:00
Nicolas Williams
d14fca0cc6
Document the lambda nature of function args #391
2014-06-13 17:22:43 -05:00
Nicolas Williams
bb83813f51
Automatically update jq.1.prebuilt
2014-06-13 17:22:17 -05:00
Nicolas Williams
8225d4e0c5
Add jqplay link to the site
2014-06-13 17:21:56 -05:00
Jingwen Owen Ou
d45195ab5c
jqplay has a domain now
2014-06-12 18:17:39 -07:00
Nicolas Williams
73bd347fcf
Add links to Solaris 11+ executables
2014-06-12 19:26:05 -05:00
Nicolas Williams
c9dbe090c5
Include links to 1.3 executables in gh-pages
2014-06-12 17:30:30 -05:00
Nicolas Williams
61cc0d4fb1
Make a better jq.1 when Ruby deps missing
2014-06-12 17:30:09 -05:00
Nico Williams
15c4a7f95f
Merge pull request #400 from kdeme/master
...
Heuristic IEEE754 endianness autoconf detection
Use AC_C_BIGENDIAN, though it's not really the correct approach. Autoconf ought to have provided a test specifically for IEEE754 endianness, since it can differ from integer/pointer endianness!
2014-06-12 15:55:41 -05:00
Kim De Mey
20e629284f
Detect endianness at configuration with Autoconf AC_C_BIGENDIAN feature
2014-06-11 10:37:32 +02:00
Nicolas Williams
e73951f3d1
Add lib.h to dist file list
2014-06-09 18:58:46 -05:00
Nicolas Williams
fdf843c08b
Make the note about shell quoting appear on site
2014-06-09 17:43:17 -05:00
Nicolas Williams
cf145ec65e
Add note about cmd.exe quoting
2014-06-09 10:22:55 -05:00
Nicolas Williams
4889844d0c
Building docs fails on powerpc ( #349 )
...
Thanks @shym!!
2014-06-09 09:39:02 -05:00
Nicolas Williams
dc7857c585
Update site news
2014-06-08 20:45:06 -05:00
Nicolas Williams
d65dbf89c9
Also fix configure.ac to use git describe --tags
2014-06-08 19:36:06 -05:00
Nicolas Williams
ed2b3e26fb
Fix scripts/version: use git describe --tags ...
...
After tagging as 1.4 scripts/version was still producing jq-1.3-....
2014-06-08 19:31:21 -05:00
Nicolas Williams
46436bd870
Add test of indices with short input
2014-06-08 02:27:27 -05:00
Nicolas Williams
1dbe9317bc
Add indices(s), improve index(s), rindex(s)
...
Now these deal with arrays as input and `s` being an array or a scalar.
2014-06-08 02:01:44 -05:00
Nicolas Williams
ef4f3a54fe
Improve index and rindex examples
2014-06-08 02:01:21 -05:00
Nicolas Williams
9af03c2562
Remove reference to getpath from docs
2014-06-08 01:35:03 -05:00
Nicolas Williams
c10e5f4e73
Document index and rindex ( #389 )
2014-06-08 00:00:17 -05:00
Santiago Lapresta
01f676041d
Added join function
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2014-06-07 21:53:03 -05:00
Nicolas Williams
6856ab8a69
String * number should be commutative
2014-06-07 21:43:30 -05:00
Nicolas Williams
8212750fe9
Add cross-compilation notes to README
...
A detailed set of instruction as to how to setup a cross-compilation
environment for OS X and Win32/64 would be nice.
2014-06-04 18:36:30 -05:00
Nicolas Williams
35b6b949e3
Add -j option to scripts/crosscompile
2014-06-04 18:36:30 -05:00
Nicolas Williams
d1ea3ab89d
Add flags argument to jv_parser_new()
...
For extensibility. We might add streaming parser options, even binary
JSON encoding options.
2014-06-04 18:35:30 -05:00
Nicolas Williams
ae625d0de7
Revert "Add -I / --online-input for huge top-level arrays"
...
This reverts commit 77936a594d .
There are too many odd bugs in this mode, and it turns out to be a bad
idea anyways. Instead, in the future a better option will be to pursue
alternative parsers, such as:
- streaming parser that outputs only when a new leaf value is added or
an array/object is opened/closed; options here include whether to
include a path in each output;
- parsers for binary JSON encodings (there's a variety of them).
Then one might run jq with a streaming parser and use `reduce` to
coalesce inputs from some depth down (instead of from one level down as
the reverted commit had intended).
Besides, a fully streaming parser is desirable in some cases, therefore
we should have such a thing as an option.
I've explored modifying the current parser to support a streaming
option, but it only makes the code very difficult to follow, which is
one reason that alternate parsers makes sense. At any rate, this is all
for the future. For now there's no streaming of individual texts, just
text sequences.
2014-06-04 18:15:58 -05:00
Nicolas Williams
5fb82d1018
Fix tests failures on Windows
...
And Solaris 8 and 9 too, no doubt. The problem was that non-standard
vsnprintf()s that return -1 when the buffer is too small were not
properly supported.
2014-06-02 00:56:01 -05:00
Nicolas Williams
f9d1b94496
Update .gitignore and config/.gitignore
2014-06-01 22:32:53 -05:00
Nico Williams
854ff5643a
Merge pull request #367 from slapresta/del-docs
...
Documented `del` command
2014-05-20 22:11:01 -05:00
Santiago Lapresta
072ebb911b
Documented del command
2014-05-21 01:23:28 +02:00
Nico Williams
d46f5d29fa
Merge pull request #360 from slapresta/275-unique-by
...
unique_by(.foo) function
2014-05-12 00:30:55 -05:00
Santiago Lapresta
69aa0003af
Added texts/examples to unique_by function
2014-05-12 01:44:53 +02:00
Santiago Lapresta
41a093c1f2
Added unique_by function
2014-05-12 01:37:27 +02:00
Nicolas Williams
022a418894
Make pthread tls configurable for Mingw build
...
For the Mingw build we don't want to pull in the pthread DLL just
because we can autodetect pthread support. That would make the jq.exe
binary not self-contained.
2014-04-17 20:17:06 -05:00
Nicolas Williams
d056668f4f
Add autoconf checks for pthreads; fix #340
2014-04-16 18:42:36 -05:00
Nico Williams
917334d18a
Merge pull request #332 from jingweno/master
...
Add link to jq playground
2014-03-20 23:47:40 -05:00
Jingwen Owen Ou
7a83f1c416
Add link to jqplay
2014-03-20 15:49:59 -07:00
Nico Williams
6f0a9521e1
Merge pull request #176 from pearkes/new-tutorial
...
Docs: Update the tutorial to use GitHub's API
2014-03-13 00:57:54 -05:00
Nicolas Williams
aee5c3ecb0
Fix for #303 in the sources
2014-03-13 00:57:33 -05:00
Nico Williams
da0d575649
Merge pull request #278 from polyester/master
...
work with newer versions of automake
2014-03-13 00:52:58 -05:00
Nicolas Williams
74d2216da2
Test arrays and friend filters
2014-03-13 00:29:53 -05:00
Nicolas Williams
769314a8a2
Document scalars
2014-03-13 00:29:53 -05:00
Nicolas Williams
831be04027
Also add scalars
2014-03-13 00:29:53 -05:00
Nicolas Williams
1a1adf73e8
Document arrays, objects, ...
2014-03-13 00:29:53 -05:00
Santiago Lapresta
68f41097b9
Added arrays and other filters
...
Arrays, objects, numbers, strings, booleans, nulls, values (non-nulls)
-- these builtins filter out those inputs that don't match the name of
the builtin.
This fixes #322 and #324 .
2014-03-13 00:27:56 -05:00
Nicolas Williams
4402c6d806
One more recursive merge test
2014-03-12 23:44:21 -05:00
Filippo Valsorda
2aa8a43c5b
Add a recursive object merge strategy and bind it to *
...
This commit adds a jv_object_merge_recursive function, that performs
recursive object merging, and binds it to multiply when applied to
two objects.
Added docs and tests.
Closes #320
2014-03-08 03:56:05 +01:00
Nicolas Williams
219bb9ecb7
Make libm tests more portable
2014-03-06 21:38:10 -06:00
Nico Williams
88fd2ee4f2
Merge pull request #310 from arodland/master
...
Make jq --raw-output --unbuffered work
2014-03-03 13:46:38 -06:00
Andrew Rodland
6c3683dfe9
Repair jv_show
2014-02-26 01:43:00 -06:00
Andrew Rodland
36e495da1e
Make jq --raw-output --unbuffered work
...
--unbuffered was only affecting the normal output case, not the --raw-output case. Make the two of them play together.
This also makes sure that the output is flushed *after* printing the newline, so a consumer doesn't lag a line behind.
2014-02-26 01:42:29 -06:00
Nicolas Williams
15faf9dc3b
Add cbrt (cube root)
2014-02-21 10:51:16 -06:00
Nicolas Williams
59302fd208
Add missing trig functions and barebones test
2014-02-21 10:49:21 -06:00
Nicolas Williams
24202d1ecf
Remove non-standard exp10()
2014-02-21 10:49:10 -06:00
Mike McCabe
336f4e27e6
Initial add of math functions.
2014-02-21 08:46:56 +00:00
Nicolas Williams
fe29d3d3fa
Add ?, .[]?, and .. operators
...
Make XPath-like `//a/b` recursive structure traversal easier in jq,
which then becomes:
..|.a?.b?
The `?` operator suppresses errors about . not being an array or object.
The `..` operator is equivalent to calling the new `recurse_down`
built-in, which in turn is equivalent to
recurse(.[]?)
Note that `..a` is not supported; neither is `...a`. That could be add
added, but it doesn't seem worth the trouble of saving the need to type
a '|'.
2014-02-20 15:33:07 -06:00
Nico Williams
3d33412e9a
Merge pull request #300 from lcd047/master
...
Fix building of the manual
2014-02-19 11:21:04 -06:00
LCD 47
fb9196021e
manual.yml: fix indent for the new any and all commands.
2014-02-19 15:10:32 +02:00
Nico Williams
b23fae9ee3
Merge pull request #296 from slapresta/all-any
...
Added `all` and `any` builtins
2014-02-16 22:45:49 -06:00
Santiago Lapresta
8b41415b07
Added all and any builtins
2014-02-17 04:01:32 +01:00
Nicolas Williams
1fa55a3fae
Fix cut-n-paste in leaf_paths; doc and test 'em
2014-02-05 23:14:05 -06:00
Nicolas Williams
a45c937f80
#285 add and builtins
2014-02-05 15:23:32 -06:00
polyester
6ed3adb091
work with newer versions of automake
...
when using a newer automake, the autoreconf step fails with warnings:
"linking libtool libraries using a non-POSIX archiver requires 'AM_PROG_AR' in 'configure.ac' "
This happens for instance on ubuntu 13.10.
Doing just that, adding 'AM_PROG_AR' to configure.ac fixes the problem.
2014-01-25 18:55:58 +01:00
Nicolas Williams
106fdf5114
Fix #201 ; check that bison accepts --warnings
2014-01-01 23:10:00 -06:00
Nicolas Williams
99f170adc3
Fix version for make dist on master
...
- Re-remove VERSION file and all traces of it
- Pass a decent version indicator to AC_INIT (using git describe)
When we tag 1.4 this will produce 1.4 as the version string when
building on the HEAD of that tag.
2013-12-31 17:19:40 -06:00
Joe Littlejohn
f60d83c15f
Fix rpm build (make rpm)
...
* Re-add VERSION as it's required for `./setup superclean`
and `make rpm`.
* Add *.rpm to git ignore, we never want them under version control.
2013-12-27 13:01:14 -06:00
Filippo Giunchedi
36a47bae56
include additional files in jq.spec
...
this will probably need changing upon SONAME bump
2013-12-27 12:49:15 -06:00
Filippo Giunchedi
dc8528af0f
fix rpm Makefile target and prerequisites
...
depend on dist and the specfile, plus use automake's variables
2013-12-27 12:49:15 -06:00
Nicolas Williams
e12d0ffd1e
Document --version
2013-12-26 18:48:51 -06:00
Nicolas Williams
a71138a43a
Add jv_dumpf() and jv_show()
...
jv_dumpf() takes a FILE *.
jv_show() is intended for use in debuggers, so it dumps the jv to stderr
and it does not jv_free() the jv, so it's safe to
"call jv_show(some_jv, -1)" in a debugger. If flags == -1 then the jv
will be shown pretty-printed and in color.
2013-12-26 18:40:34 -06:00
Nicolas Williams
cb976b9a50
Document .foo.bar in manual
2013-12-26 18:25:31 -06:00
Nicolas Williams
060eb39bf9
Document exit numbers
2013-12-26 12:54:07 -06:00
Nicolas Williams
ab363e9e50
Normalize errors for -e
2013-12-26 12:54:03 -06:00
Nicolas Williams
41a8ae7557
Fix doc typos (.[foo] wanted to be .["foo"])
2013-12-25 17:09:27 -06:00
Nicolas Williams
1956abbedf
Add note to jq.1 about shell quoting
2013-12-25 17:05:32 -06:00
Stephen Dolan
2003a0440f
Merge pull request #251 from phihag/fix-uri-in-manual
...
Fix @uri example
2013-12-21 11:47:24 -08:00
Stephen Dolan
a0274cc46e
Merge pull request #252 from phihag/ignore-config-test-driver
...
Ignore the config/test-driver file
2013-12-21 11:46:53 -08:00
Philipp Hagemeister
3b384740b9
Ignore the config/test-driver file
...
This file is automatically generated and does not need to be committed.
2013-12-20 11:36:52 +01:00
Philipp Hagemeister
4d40a47eab
Fix @uri example
...
Previously, the @uri example didn't match the actual behavior of the current jq, as exclamation marks do not need to be encoded in URIs.
Replace the example with an input that needs encoding, and is encoded by jq.
2013-12-20 11:32:53 +01:00
Stephen Dolan
18e828f17c
Allow negated object values without parens. Fixes #247
2013-12-17 22:28:31 +00:00
Nicolas Williams
0966230ba8
Fix memmem() error
2013-12-17 08:40:03 -06:00
Stephen Dolan
669f4ab4c3
Merge pull request #242 from sieben/travis-ci
...
Adding a .travis.yml file to use the travis-ci.org
2013-12-15 12:54:17 -08:00
Rémy Léone
3455714410
Adding a .travis.yml file to use the travis-ci.org
...
From wikipedia:
Travis CI is a hosted, distributed continuous integration service used
to build and test projects hosted at GitHub.
Travis CI is configured by adding a file named .travis.yml, which is a
YAML format text file, to the root directory of the GitHub repository.
Travis CI automatically detects when a commit has been made and pushed
to a GitHub repository that is using Travis CI, and each time this
happens, it will try to build the project and run tests. This includes
commits to all branches, not just to the master branch. When that
process has completed, it will notify a developer in the way it has been
configured to do so — for example, by sending an email containing the
test results (showing success or failure), or by posting a message on an
IRC channel. It can be configured to run the tests on a range of
different machines, with different software installed (such as older
versions of a programming language, to test for compatibility).
2013-12-13 17:14:37 +01:00
Stephen Dolan
32ea50d336
Make the testsuite run on machines without valgrind
2013-12-13 15:22:17 +00:00
Stephen Dolan
5ac6a460fa
Format more integers as integers, not scientific notation.
...
jq is now willing to put up to 15 zeros after an integer before
moving to scientific notation.
2013-12-13 15:22:17 +00:00
Stephen Dolan
f147b7fae5
Merge pull request #239 from DRMacIver/overflows
...
Avoid undefined behaviour with large array indices
2013-12-12 16:38:14 -08:00
Nicolas Williams
474386a1d9
Complete more-arity feature not complete
...
And test
2013-12-11 14:14:26 -06:00
Stephen Dolan
7fd2c2d08b
Merge pull request #235 from DRMacIver/prototypes
...
some functions were missing proper prototypes
2013-12-10 03:56:02 -08:00
David R. MacIver
5412f3f1c1
convert range bounds to integers in a way that avoids undefined behaviour
2013-12-10 09:20:13 +00:00
David R. MacIver
014b45b4a9
add checking of numeric indices to an array to see if they can reasonably be considered integers. Avoid undefined behaviour if out of bounds
2013-12-10 09:20:12 +00:00
David R. MacIver
30ea390b77
some functions were missing prototypes. Add them
2013-12-10 00:07:08 +00:00
Stephen Dolan
00f244385b
Merge pull request #232 from DRMacIver/teardown_on_error
...
consistent use of goto out in main
2013-12-08 16:41:16 -08:00
David R. MacIver
7b671b95d2
don't need to check for NULL there
2013-12-08 23:52:07 +00:00
Stephen Dolan
1535f23455
Merge pull request #233 from DRMacIver/printf
...
Fix warnings about vprintf
2013-12-08 15:44:33 -08:00
Stephen Dolan
4ba0c8baef
Merge pull request #231 from DRMacIver/fix_mem_leak_in_compile
...
args to jq_compile_args were not getting freed when there were errors in the compile
2013-12-08 15:17:20 -08:00
Stephen Dolan
a7dd3ab793
Clean up string/object interactions in jv.
2013-12-08 22:49:28 +00:00
David R. MacIver
f6f7d4d973
These vfprintfs are being used as if they were printfs. Fix that
2013-12-08 20:08:04 +00:00
David R. MacIver
f4ae5c883b
consistent use of goto out in main
2013-12-08 19:22:18 +00:00
Stephen Dolan
74a14f5de7
Refactor jv structure.
...
New structure layout is simpler and also faster. In particular, it's
now small enough to be passed in registers on amd64.
2013-12-08 17:46:23 +00:00
Stephen Dolan
fee21c959a
Make testsuite not leak when compiled with -DNDEBUG.
2013-12-08 17:44:54 +00:00
David R. MacIver
4b48054f41
test for losing memory on compile errors
2013-12-08 16:19:12 +00:00
David R. MacIver
17a319d120
args to jq_compile_args were not getting freed when there were errors in the compile
2013-12-08 15:28:29 +00:00
Nicolas Williams
3a1dab5396
Fix double-free typo in print_error()
2013-12-06 23:25:06 -06:00
Nicolas Williams
dac081e183
Fix manual.yml
2013-12-06 11:58:55 -06:00
Stephen Dolan
489fcdc089
Merge pull request #224 from nicowilliams/features
...
Features: more arity, string ops
2013-12-04 17:36:08 -08:00
Nicolas Williams
3ba7c97b2a
Add self to AUTHORS
2013-12-04 18:21:42 -06:00
Nicolas Williams
54635000c5
Conditionally #define _GNU_SOURCE in compile.c
2013-12-04 18:21:42 -06:00
Nicolas Williams
426edff09c
Add tests for string index by string and builtins
2013-12-04 18:21:42 -06:00
Nicolas Williams
b37ce20c2a
Add index and rindex builtins
2013-12-04 18:21:42 -06:00
Nicolas Williams
cac14a531d
Add index strings by string; return string indexes
...
% jq '.[","]'
"a,bc,def,ghij,klmno"
[1,4,8,13]
%
2013-12-04 18:21:42 -06:00
Nicolas Williams
ae7a042876
Make length return abs value of numeric inputs
2013-12-04 18:21:42 -06:00
Nicolas Williams
eb165459aa
Add callback interface for errors
...
Printing to stderr is not the right answer for a library.
2013-12-04 18:21:41 -06:00
Nicolas Williams
04bc2ef7cf
Add jv_string_vfmt()
2013-12-04 18:21:41 -06:00
Nicolas Williams
09104ce531
Document ltrimstr and rtrimstr
2013-12-04 18:21:41 -06:00
Nicolas Williams
9fa2173825
Test ltrimstr and rtrimstr functions
2013-12-04 18:21:41 -06:00
Nicolas Williams
346da34432
Add ltrimstr and rtrimstr functions
2013-12-04 18:21:41 -06:00
Nicolas Williams
fa316ac430
Document -u / --unslurp option
2013-12-04 18:21:41 -06:00
Nicolas Williams
77936a594d
Add -I / --online-input for huge top-level arrays
2013-12-04 18:21:41 -06:00
Nicolas Williams
4e07eac356
Document -e / --exit-status argument
2013-12-04 18:21:40 -06:00
Nicolas Williams
d018e43ddc
Add -e | --exit-status CLI option
2013-12-04 18:21:40 -06:00
Nicolas Williams
8cee66e609
Document tojson and fromjson builtins
2013-12-04 18:21:40 -06:00
Nicolas Williams
3c4248192d
Test tojson and fromjson
2013-12-04 18:21:40 -06:00
Nicolas Williams
255f8ef5be
Add tojson and fromjson builtins
2013-12-04 18:21:40 -06:00
Nicolas Williams
20b32db5af
Document split function
2013-12-04 18:21:40 -06:00
Nicolas Williams
b634722c8a
Document string multiplication and division
2013-12-04 18:21:40 -06:00
Nicolas Williams
c9e8581f45
Document string functions and slicing
2013-12-04 18:21:39 -06:00
Nicolas Williams
da129f6664
Test string slicing
2013-12-04 18:21:39 -06:00
Nicolas Williams
884e6c7d8b
Add string slicing
2013-12-04 18:21:39 -06:00
Nicolas Williams
5aadaa79eb
Add tests for string division/splitting
2013-12-04 18:21:39 -06:00
Nicolas Williams
cf562961b7
Add string division by string (split on separator)
2013-12-04 18:21:39 -06:00
Nicolas Williams
63bed9bdf1
Test starts/endswith and string multiplication
2013-12-04 18:21:39 -06:00
Nicolas Williams
5989dbdfcf
Add string multiplication by number
2013-12-04 18:21:39 -06:00
Nicolas Williams
db19a11399
Add startswith/endswith
2013-12-04 18:21:38 -06:00
Nicolas Williams
6c734cb609
Add explode/implode jq functions to match jv API
2013-12-04 18:21:38 -06:00
Nicolas Williams
ef41d1cb57
Use uint32_t for codepoint in jv_string_append_codepoint()
2013-12-04 18:21:38 -06:00
Nicolas Williams
08b4a34a8e
Add jv string utility functions
...
jv_string_empty()
-> return an empty string with given allocated length (for fast
appends)
jv_string_append_codepoint
-> append a single codepoint (int) to the given string
jv_string_explode
-> return an array of codepoints making up a string
jv_string_implode
-> return the UTF-8 encoding of an array of codepoint numbers
2013-12-04 18:21:38 -06:00
Nicolas Williams
1fc5656762
Support more arguments for defs
2013-12-04 18:21:38 -06:00
Stephen Dolan
91cfc34ae4
Preserve insertion order in objects. Closes #169 .
2013-12-04 22:30:39 +00:00
Nicolas Pouillard
a0b942a7f5
Add a few more test cases (from the man page)
...
Signed-off-by: Nicolas Williams <nico@cryptonector.com >
2013-11-30 00:55:26 -06:00
Stephen Dolan
6a401c8262
Add a --unbuffered option. Closes #206
2013-11-08 12:21:45 +00:00
Stephen Dolan
d235f32bc9
Merge pull request #210 from Habbie/patch-1
...
count should be length
2013-11-08 03:43:57 -08:00
Peter van Dijk
bdbfa7e32c
count should be length
...
Example refers to a count function, which does not exist. Replacing it with length works.
2013-11-07 16:39:44 +01:00
Stephen Dolan
78976b3504
Merge pull request #193 from ryo1kato/fix-docs
...
Docs: add description of --from-file option
2013-11-07 04:41:01 -08:00
Stephen Dolan
8d4748c8df
Fix a crash on group_by of empty list. Fixes #208 .
2013-11-07 12:18:48 +00:00
Ryoichi KATO
da723d3e11
Docs: add description of --from-file option
2013-10-16 21:42:29 +09:00
Stephen Dolan
0feeb7d0d4
Merge pull request #188 from Juanxo/patch-1
...
Fix typo on error message
2013-10-07 06:59:50 -07:00
Juan Guerrero
9e53f36a74
Fix typo on error message
2013-10-06 17:52:04 +02:00
Stephen Dolan
7e7c08da47
Merge pull request #185 from qoelet/master
...
Add missing -i flag in build instructions
2013-09-20 06:05:42 -07:00
Kenny Shen
2f6b89ef70
Add missing -i flag in build instructions
2013-09-20 10:34:57 +08:00
Stephen Dolan
4e3024cb61
Merge pull request #182 from mdaines/sqrt-builtin
...
Add builtin for calculating square root
2013-09-14 16:34:52 -07:00
Michael Daines
c427bf6a94
Add test showing calculation of standard deviation
2013-09-14 17:48:19 -04:00
Stephen Dolan
dae2422fd1
Merge branch 'libjq'
...
Conflicts:
Makefile.am
configure.ac
2013-09-14 19:30:39 +01:00
Stephen Dolan
f98e3e6c26
Merge pull request #181 from mdaines/patch-1
...
Fix typo
2013-09-13 15:24:22 -07:00
Mike Daines
fe99532f8b
Fix typo
2013-09-13 12:15:52 -04:00
Stephen Dolan
41a4968c90
Merge pull request #171 from joelittlejohn/fix-makefile
...
Fix Makefile after refactoring of stacks in 05d90517b0
2013-09-13 09:02:42 -07:00
Stephen Dolan
1cdaabf2dd
Merge pull request #175 from lipidity/fix-build
...
Call AM_INIT_AUTOMAKE once only
2013-09-13 09:02:24 -07:00
Michael Daines
82d8253c19
Add sqrt operator
2013-09-11 20:24:41 -04:00
Jack Pearkes
c1717d6e12
docs: update the tutorial to use GitHub's API
2013-09-04 11:42:40 +02:00
Ankur
f0d1c39b5b
Call AM_INIT_AUTOMAKE once only
...
Fixes build with automake-1.14
2013-09-01 18:58:26 +10:00
Joe Littlejohn
111aea3f0a
Fix Makefile after refactoring of stacks in 05d90517b0
2013-08-19 13:40:08 +01:00
Stephen Dolan
37cfc912c1
Remove #includes from jv.h
2013-06-23 14:23:07 +01:00
Stephen Dolan
8c2e228c74
Fix the jv_parser interface.
2013-06-23 12:26:49 +01:00
Stephen Dolan
8630fb02bb
Use libtool's built-in symbol exporting rather than a mapfile.
2013-06-23 12:10:58 +01:00
Stephen Dolan
5052ab4e2b
Move gen_utf8_tables to scripts
2013-06-23 12:08:22 +01:00
Stephen Dolan
a44f739356
Move libtool m4 junk to config/ and delete some autogenerated files.
2013-06-23 12:01:58 +01:00
Stephen Dolan
f44ecf3872
Remove Autoconf-generated config.h.
2013-06-23 12:01:58 +01:00
Stephen Dolan
1c9e03f800
Merge branch 'header-cleanup' into libjq
...
Conflicts:
Makefile.am
2013-06-22 23:27:16 +01:00
Stephen Dolan
5d9ec83805
Build libjq only once, and link it statically to ./jq
...
This means ./jq is a real binary rather than a libtool turd.
2013-06-22 20:53:28 +01:00
Stephen Dolan
3a295c659b
Fix distcheck.
...
Update list of files to be distributed.
2013-06-22 20:53:03 +01:00
Stephen Dolan
d253414783
Merge pull request #162 from stedolan/utf8-fixes
...
Utf8 fixes. Closes #161
2013-06-22 09:30:59 -07:00
Stephen Dolan
8b1b503609
Reject all overlong UTF8 sequences.
2013-06-22 13:43:46 +01:00
Stephen Dolan
ff48bd6ec5
Fix various UTF8 parsing bugs.
...
In particular, parse bad UTF8 by replacing the broken bits with U+FFFD
and resychronise correctly after broken sequences.
2013-06-22 13:34:24 +01:00
Stephen Dolan
54b9c9bdb2
Fix example in manual for floor. See #155 .
2013-06-22 12:17:28 +01:00
Nicolas Williams
3dcdc582ea
Document floor
2013-06-21 15:27:34 -05:00
Nicolas Williams
7c4171d414
Add floor operator
2013-06-21 15:27:34 -05:00
Nicolas Williams
1d839ff9df
Document mod
2013-06-21 15:27:34 -05:00
Nicolas Williams
3403d07912
Add mod (and setmod) operators
2013-06-21 15:27:34 -05:00
Nicolas Williams
e8643787cf
Update .gitignore
2013-06-21 12:41:57 -05:00
Nicolas Williams
298b2a6033
Add libjq autoconf goo
2013-06-21 11:57:12 -05:00
Nicolas Williams
c791428905
Quiet setup.sh re: tmp dir
2013-06-21 11:57:11 -05:00
Stephen Dolan
dc2fe63e42
Merge pull request #157 from nicowilliams/argfile-fixes
...
Argfile fixes
2013-06-21 09:40:32 -07:00
Stephen Dolan
7af88962ee
Move cfunction invocation code to the interpreter loop.
2013-06-21 12:06:28 +01:00
Nicolas Williams
3216d7683a
Fix serious bug in handling of --argfile
2013-06-18 19:05:52 -05:00
Nicolas Williams
e4094c8664
Fix leaks in jv_load_file()
2013-06-18 19:05:52 -05:00
Stephen Dolan
b49d65a276
Fold opcode.{c,h} into bytecode.{c,h}
2013-06-18 01:36:18 +01:00
Stephen Dolan
824ce76cec
Simplify block functions for variables
2013-06-18 01:07:18 +01:00
Stephen Dolan
2a18f97d12
Saner build instructions in README.md
...
Closes #144
2013-06-18 00:29:05 +01:00
Stephen Dolan
8c4d29ee38
Remove some initialise-to-zero code.
...
This lets valgrind find more bugs - if a field isn't given a
well-defined value valgrind will now find it instead of seeing it
set to zero with memset.
2013-06-18 00:17:20 +01:00
Stephen Dolan
2c13f4fe72
Merge branch 'stack-refactor-merge'
2013-06-18 00:13:44 +01:00
Stephen Dolan
94931040a8
Merge branch 'stack-refactor'
...
Conflicts:
execute.c
2013-06-18 00:06:00 +01:00
Stephen Dolan
b78a4cdc93
Merge pull request #154 from nicowilliams/no-fopen-re
...
Remove accidentally introduced use of fopen "e"
2013-06-17 15:34:01 -07:00
Nicolas Williams
da09544bb0
Remove accidentally introduced use of fopen "e"
2013-06-17 17:27:25 -05:00
Stephen Dolan
ce17b6bd53
Merge pull request #114 from nicowilliams/nomem_handler
...
Add jv_nomem_handler()
2013-06-16 06:20:27 -07:00
Nicolas Williams
fe03bea191
Remove last remnant of main.h
2013-06-16 08:06:52 -05:00
Nicolas Williams
0ed6347d47
Allow --run-tests to take a file argument
2013-06-15 17:37:15 -05:00
Nicolas Williams
3f86e97f70
Fixup API to get closer to a libjq
2013-06-15 17:37:15 -05:00
Stephen Dolan
69fa279e3c
Merge pull request #150 from nicowilliams/jv_load_file
...
Move slurp_file() into library as jv_load_file()
2013-06-15 05:29:17 -07:00
Nicolas Williams
bbf4e05fde
Move slurp_file() into library as jv_load_file()
...
Needed as part of creating a libjq.
2013-06-15 00:08:59 -05:00
Stephen Dolan
05d90517b0
Clean up lots of stack and frame logic.
...
Move frame defs to execute.c
2013-06-14 22:08:18 +01:00
Stephen Dolan
5f5c1dc5a6
Simplify frame logic.
2013-06-14 01:20:24 +01:00
Stephen Dolan
e0524644f8
Unify all stacks. Passes tests, but needs cleanup.
2013-06-13 21:50:32 +01:00
Stephen Dolan
81e2336ace
Support ."foo" syntax for accessing fields. See #141 .
2013-06-11 22:26:39 +01:00
Stephen Dolan
25bf1a0169
Unify frame and data stacks
2013-06-10 01:17:58 +01:00
Stephen Dolan
c8ab67be27
Speed up cached configure (./configure -C)
2013-06-05 16:40:01 +01:00
Stephen Dolan
6c34288ebf
Clean up flex lines in build
2013-06-05 13:43:23 +01:00
Stephen Dolan
2ffbb9d6b7
Lex and parse .foo better.
...
'.as' is now valid, '. foo' is now invalid. See #141 .
2013-06-05 13:41:56 +01:00
Stephen Dolan
dad608d5c0
Merge pull request #142 from lanthaler/master
...
Update README.md
2013-06-04 04:13:24 -07:00
Markus Lanthaler
04b939625b
Update README.md
...
Update the link to the documentation. All GitHub pages are now using the github.io domain.
2013-06-04 13:04:42 +02:00
Stephen Dolan
5dac485458
Make jq --version print to stdout, not stderr
2013-06-03 23:22:59 +01:00
Stephen Dolan
2c4ccd122e
Better error handling for .foo case in parser. See #141 .
2013-06-03 23:12:31 +01:00
Stephen Dolan
b90ae078b8
Let the parser rather than the lexer handle invalid characters.
2013-06-03 23:12:31 +01:00
Stephen Dolan
cc8761dbde
Add command-line option to sort object keys.
...
Closes #79 .
2013-06-03 23:12:31 +01:00
Stephen Dolan
08cc591884
Clean up Makefile.am (distcheck, rebuild version.h less often)
2013-06-03 23:12:31 +01:00
Stephen Dolan
1bc4d04f43
Merge pull request #139 from 13ren/stopwarning
...
Stop warning on fgets, jq_test.c:42
2013-06-01 07:30:15 -07:00
Brendan Macmillan
d4018192a9
Stop warning on fgets, simple version
2013-06-01 11:12:28 +10:00
Brendan Macmillan
19ddbfeca9
Stop warning on fgets, complex version
2013-06-01 11:03:15 +10:00
Stephen Dolan
4fed6763fc
Squash a warning on some GCC versions
2013-05-31 12:15:58 +01:00
Stephen Dolan
73446a9cce
Support for printing object keys in sorted order.
...
No command-line option to enable this yet. See #79 .
2013-05-29 11:47:12 +01:00
Stephen Dolan
dcf1ac0d1f
Merge pull request #135 from 13ren/locfile_bugfix
...
Locfile bugfix
2013-05-29 03:38:15 -07:00
Stephen Dolan
364c58d13f
Merge pull request #130 from 13ren/libload_2
...
libload_2 (update to pull request #126 , for issue #112 )
2013-05-29 03:37:36 -07:00
Brendan Macmillan
8cfe11e4e2
Bugfix multiline off-by-one (locfile.c)
2013-05-29 15:23:08 +10:00
Brendan Macmillan
40378a18f7
locfile.h -> locfile.h + locfile.c
...
clean up includes of a few files
2013-05-29 15:17:01 +10:00
Brendan Macmillan
7fb5d8c973
Hack bugfix for multiline off-by-one (locfile.c)
2013-05-29 15:16:45 +10:00
Brendan Macmillan
6e373942e5
Load library from ~/.jq
2013-05-29 15:05:40 +10:00
Stephen Dolan
f0b982795c
Make jq --version report an actual git revision.
...
Closes #129 .
2013-05-24 23:35:38 +01:00
Stephen Dolan
cbd422d56e
Merge pull request #133 from nicowilliams/option_argfile-rebase0
...
Add --argfile variant of --arg (issue #117 )
2013-05-24 04:13:45 -07:00
Nicolas Williams
03598bb5d6
Add --argfile variant of --arg (issue #117 )
...
This is useful when one has a database (in JSON form) to query using jq
input data.
% echo '{"a":1, "c":5}' > db.json
% echo '"c"'|./jq --argfile f /tmp/a '$f[.]'
5
% echo '"a"'|./jq --argfile f /tmp/a '$f[.]'
1
% echo '"b"'|./jq --argfile f /tmp/a '$f[.]'
null
%
2013-05-23 13:52:06 -05:00
Stephen Dolan
983a53a643
'make clean' won't delete jq.1 if it can't be rebuilt.
...
See #131
2013-05-23 19:20:19 +01:00
Stephen Dolan
0535e724a2
jq 1.3 release
2013-05-19 11:48:18 +01:00
Stephen Dolan
fd1ac5dd79
EACH need not make a backtrack point on the last iteration
2013-05-17 22:49:08 +01:00
Stephen Dolan
9b91eafac4
Make array construction use LOADVN (slightly faster)
2013-05-16 15:09:59 +01:00
Stephen Dolan
bc42812715
Remove the insane "fold" operation, replace with saner "reduce".
2013-05-16 15:07:53 +01:00
Stephen Dolan
8fbee891b3
Add LOADVN opcode.
...
Does a variable load, but sets the variable to be null afterwards.
2013-05-16 15:02:18 +01:00
Stephen Dolan
919292764a
Reverse function. Closes #94 .
2013-05-16 14:25:28 +01:00
Stephen Dolan
a1e4dfa324
Better debug info for struct bytecode.
...
--debug-dump-disasm produces more comprehensible output now.
2013-05-16 00:51:17 +01:00
Stephen Dolan
f8644c31a3
Only generate code for those builtin functions actually used.
...
Makes output of --debug-dump-disasm much simpler.
2013-05-15 01:37:15 +01:00
Stephen Dolan
1e2851cdb3
Remove the YIELD opcode (use RET instead)
2013-05-15 01:23:06 +01:00
Stephen Dolan
e83e51eb56
'length' function now measures string length in codepoints, not bytes.
2013-05-15 00:37:38 +01:00
Stephen Dolan
c496a924ce
Bugfix for array slices.
2013-05-15 00:22:44 +01:00
Stephen Dolan
81be37b236
Add the range function
2013-05-14 16:09:10 +01:00
Stephen Dolan
4d540b7102
Fix some documentation bugs
2013-05-13 20:26:44 +01:00
Stephen Dolan
33901b74b1
Array slicing. Closes #2 .
2013-05-13 20:16:19 +01:00
Stephen Dolan
a47cfa4757
Delete unnecessary _POSIX_SOURCE. Closes #89
2013-05-13 16:41:11 +01:00
Stephen Dolan
a625d2821e
Add to_entries, from_entries and with_entries functions.
...
Closes #97 .
2013-05-13 16:15:49 +01:00
Stephen Dolan
d8706fd460
Fix the //= operator.
...
Closes #62 .
2013-05-13 16:04:30 +01:00
Stephen Dolan
e13f24ab45
Better error handling for INSERT opcode
...
jq 'null | {(.a): 1}' no longer crashes.
2013-05-13 15:42:57 +01:00
Stephen Dolan
34a63246ab
Remove the is_backtrack_frame special case hack.
2013-05-13 15:37:57 +01:00
Stephen Dolan
8c708f3c7a
Refactor path logic.
2013-05-13 15:00:05 +01:00
Stephen Dolan
b0e65d149f
Fix a bug triggered by jv_array_slice.
2013-05-13 14:10:39 +01:00
Stephen Dolan
e29db8d272
Fix bug with path handling (used in assignments).
...
Closes #67
2013-05-11 18:10:21 +01:00
Stephen Dolan
7ca5127fcc
Merge branch 'autotools'
2013-05-11 15:21:23 +01:00
Stephen Dolan
4b1b9c219a
Delete some Autotools junk and update README.
...
Autotools autogenerated files that change frequently have been
removed, those that don't are still checked in.
2013-05-11 15:15:56 +01:00
Stephen Dolan
4a5405e4b8
Rake task to build website including source dist and binaries.
2013-05-11 14:57:58 +01:00
Stephen Dolan
d03149f4df
Rake task to build source distribution for website
2013-05-11 14:48:39 +01:00
Stephen Dolan
18cf4ad475
Add the docs to the distributed tarballs
2013-05-09 20:53:51 +01:00
Stephen Dolan
ba4bb136bb
Fix manpage build.
2013-05-09 20:43:26 +01:00
Stephen Dolan
e6494857fc
Add some build instructions for how to install doc dependencies.
...
jq can now build without Ruby, but you won't get a nice manpage.
2013-05-09 20:35:19 +01:00
Stephen Dolan
12d2d4d1f5
Don't build the manpage unless there's a working Ruby setup.
2013-05-09 15:22:38 +01:00
Stephen Dolan
d75414bc94
support for out-of-tree tests
2013-05-09 13:40:00 +01:00
Stephen Dolan
a592c98461
Fail properly when attempting to build manpage without rake
2013-05-09 13:10:09 +01:00
Stephen Dolan
f6089a627a
Autotools hackery so that "make dist" builds lexer and parser.
2013-05-09 11:31:17 +01:00
Stephen Dolan
898dc8978b
Add a redundant intialisation to squash a gcc warning.
2013-05-09 11:30:49 +01:00
Stephen Dolan
d43084086b
Make manpage building more robust.
2013-05-09 02:38:57 +01:00
Stephen Dolan
124bda6993
Add a "binaries" target to the website Rakefile.
2013-05-09 02:18:28 +01:00
Stephen Dolan
7fbc50239c
Minor docs fix to get rid of Bonsai warnings.
2013-05-09 02:01:01 +01:00
Stephen Dolan
282667bbd4
Script for cross-compiling jq binaries for other platforms.
2013-05-09 01:50:20 +01:00
Stephen Dolan
63b689bf54
Use the version number from configure.ac in the website.
2013-05-08 19:57:29 +01:00
Stephen Dolan
c710f91257
Add the parser to BUILT_SOURCES
2013-05-08 19:57:05 +01:00
Stephen Dolan
a511d03d85
Configure whether colour is displayed by default directly in source
2013-05-08 19:37:12 +01:00
Stephen Dolan
9d245c88c4
Check in a pile of Autotools junk, including the configure script.
2013-05-08 18:55:10 +01:00
Stephen Dolan
7813f363a2
Merge pull request #115 from nicowilliams/complex
...
Rename complex to nontrivial for safety (#113 )
2013-05-08 07:07:31 -07:00
Stephen Dolan
d121420757
Clean up autotools config.
...
Remove some of @stagrlee's hard work since jq's testsuite is
less silly than when he wrote the autotools config.
2013-05-08 02:42:23 +01:00
Stephen Dolan
1ebb382540
Check in jv_utf8_tables.gen.h, it is unlikely to change.
2013-05-08 01:33:04 +01:00
Stephen Dolan
2363246eea
Merge remote-tracking branch 'stagrlee/master' into autotools
...
Conflicts:
Makefile
jq_test.c
2013-05-08 00:52:24 +01:00
Nicolas Williams
fb3c124af1
Rename complex to nontrivial for safety ( #113 )
2013-05-07 18:46:13 -05:00
Stephen Dolan
46814da91a
Merge pull request #119 from 13ren/master
...
tiny typo fix in manual
2013-05-07 03:57:47 -07:00
Nicolas Williams
65deaaacf5
Fix #111 : exit(1) when inputs are not valid JSON
2013-05-06 12:36:53 -05:00
Stephen Dolan
74eb914aba
Add trailing slashes to various internal doc links.
...
Fixes #110
2013-05-06 15:03:14 +01:00
Stephen Dolan
5be97463ec
Add a --arg option to allow variables to be passed from the cmdline.
...
Closes #107
2013-05-06 14:21:00 +01:00
Stephen Dolan
48be23233a
Add the "has" function. Closes #74 .
2013-05-06 13:46:54 +01:00
Stephen Dolan
88a6dc5343
Merge pull request #77 from jkleint/patch-1
...
Clarify description of `as`
2013-05-05 18:39:59 -07:00
Stephen Dolan
fee38afd8b
Document behaviour of .[] on objects.
...
Closes #57 .
2013-05-06 02:37:34 +01:00
Stephen Dolan
cacda19e75
Add documentation for "type".
...
Closes #75 .
2013-05-06 02:34:02 +01:00
Stephen Dolan
7f979cf1c7
Update gems and use HTTPS to get them.
2013-05-06 01:15:33 +01:00
Stephen Dolan
8bf4a73f3d
Fix some bad escaping
2013-05-06 01:14:53 +01:00
Stephen Dolan
d04bd897e3
Merge commit 'e45f93f85f22c73025830a6bd0b2807263068996'
...
See #87
2013-05-05 23:58:24 +01:00
Stephen Dolan
1741d8c161
Remove JQ_DEBUG #define and jq_test binary, simplifying build.
...
The debugging features previously available via JQ_DEBUG are now
command-line options.
2013-05-05 23:12:10 +01:00
Stephen Dolan
c1748fa633
WIP
2013-05-05 22:59:53 +01:00
Stephen Dolan
a49402c53a
Combine the functionality of jq and jq_test
...
One binary is much simpler. ./jq --run-tests now runs the tests.
2013-05-05 22:59:53 +01:00
Stephen Dolan
47e015e946
Make a few constant globals actually const.
...
This means the .data and .bss sections are empty, a good thing
in a shared library (see #98 ).
2013-05-05 22:59:53 +01:00
Stephen Dolan
ab1a97472c
Merge pull request #109 from nicowilliams/no_mutable_globals-rebased
...
Remove globals/make jq_init/next/teardown() an API
2013-05-05 12:29:07 -07:00
Stephen Dolan
74df082283
Merge pull request #93 from shayel/master
...
Allow manpage to build
2013-05-05 12:13:36 -07:00
Nicolas Williams
a136c3b7c9
Build and install libjq
2013-04-28 20:12:49 -05:00
Nicolas Williams
312ab754a2
Remove unnecessary #includes
2013-04-28 20:12:15 -05:00
Nicolas Williams
87e9c64003
Remove globals/make jq_init/next/teardown() an API
2013-04-28 18:46:21 -05:00
Shay Elkin
054e3f3795
Add missing require to Rakefile
...
Use bundle exec to make manpage
Don't set executable bit on manpage
2013-03-24 14:45:10 +02:00
Simon Elsbrock
e45f93f85f
fix typo in manual
2013-02-20 22:38:50 +01:00
Lee Thompson
dc4d3d8cbe
get man pages working
2013-02-04 13:35:42 -06:00
Lee Thompson
1d3d2efc89
add man page to release
2013-02-04 07:01:18 -06:00
Lee Thompson
43fd939f16
rework build to not distribute tests unless --enable-devel is specificied to autoconf
2013-02-03 14:49:03 -06:00
Lee Thompson
d8a072ca01
fix email addresses
2013-02-03 00:35:56 -06:00
Lee Thompson
f62184855b
use AM_SILENT_RULES
2013-02-03 00:09:47 -06:00
Lee Thompson
0370d5b526
fix RPM build process
2013-02-02 23:50:43 -06:00
Lee Thompson
52f906ab43
fix jq_test so that it runs in the distcheck phase of autoconf
2013-02-02 23:05:00 -06:00
Lee Thompson
c7725a8d4d
merging upstream stedolan changes
2013-02-02 20:39:23 -06:00
Lee Thompson
dd70eeb29d
use built in macro to RPM
2013-01-29 19:13:22 -06:00
jkleint
115552f3a6
Clarify description of as
...
It's more of a foreach loop than an identity operation.
Addresses issue #72 .
2013-01-25 12:17:56 -05:00
13ren
d0cd26cd8e
Update docs/content/3.manual/manual.yml
...
There's a , after map ; should be .
#65
2013-01-13 17:33:01 +11:00
Stephen Dolan
925ec3751f
Fix negative number syntax. Add a unary '-' operator.
...
Closes #63 .
2013-01-03 12:53:23 +00:00
Stephen Dolan
c013b557a2
Change APPEND opcode to directly modify a variable.
...
Avoids a big O(n^2) loop in constructing arrays. Fixes #61 .
2013-01-03 12:51:33 +00:00
Stephen Dolan
fb84541e11
Clean up jv_object_foreach and add jv_array_foreach
2012-12-31 23:27:00 +00:00
Stephen Dolan
38fe6fc0cb
Ignore some more stuff.
2012-12-31 23:25:12 +00:00
Stephen Dolan
b3bad59dd7
Add the recurse function. See #37 .
2012-12-29 22:59:07 +00:00
Stephen Dolan
e0cda536f3
Make null + foo return foo, rather than an error.
...
This also allows 'add' to be implemented in jq rather than C.
2012-12-29 16:52:26 +00:00
Stephen Dolan
d5fdf70434
Refactor assignment.
...
New version is much more elegant and probably slower. Uses
library functions implemented in jq rather than dedicated opcodes.
2012-12-29 16:43:36 +00:00
Stephen Dolan
465a4ec565
Improvements to del(foo).
...
del(foo,bar) is now very different from del(foo),del(bar).
See #37 .
2012-12-29 16:13:06 +00:00
Stephen Dolan
3a5377e183
Fix a bug in URI-encoding of certain non-ASCII characters.
...
Oh how I hate C casting rules.
2012-12-29 01:37:22 +00:00
Stephen Dolan
79c9c418c6
Path manipulation (path/getpath/setpath/delpath) and docs.
...
del function should fix #37 .
2012-12-28 16:08:29 +00:00
Stephen Dolan
f1e23448e7
Support for two-argument functions.
...
Should probably support n args instead. This is a quick hack.
Also, ';' is a slightly ugly argument separator.
2012-12-28 15:07:27 +00:00
Stephen Dolan
417899f9a0
Fold operation (code/docs/test)
2012-12-28 15:05:34 +00:00
Stephen Dolan
9302b16247
Docs typos.
2012-12-28 14:23:28 +00:00
Stephen Dolan
89e26969ae
@foo syntax for encoding of strings into various formats.
...
Fixes part of #47 and #48 .
2012-12-28 01:23:09 +00:00
Stephen Dolan
52db8000c6
Fix an embarassing I/O bug.
...
Pulling some I/O out to a function meant that buf changed from
"char buf[4096]" to "char* buf", and "sizeof(buf)" got a lot
less interesting. The upshot of this is that jq read input eight
bytes at a time, which is not the fastest.
2012-12-27 01:57:09 +00:00
Stephen Dolan
d327772dfc
JSON parsing error messages now specify a location of the error.
...
Should help with #53 .
2012-12-27 01:56:23 +00:00
Stephen Dolan
cedda2084d
Sneaky valgrind trick to detect stack memory issues.
...
After something is popped from a stack, we overwrite the memory
with uninitialised data (if JQ_DEBUG is on). This means that
valgrind reports use-after-pop as an uninitialised memory error.
2012-12-24 17:11:18 +00:00
Stephen Dolan
0fed03f35a
Fix a bad memory leak when using --raw-output
2012-12-23 15:41:20 +00:00
Stephen Dolan
5578ec0f69
Give Windows builds a proper .exe suffix.
2012-12-20 15:12:14 +00:00
Stephen Dolan
a05904b226
Version 1.2!
2012-12-20 12:26:15 +00:00
Stephen Dolan
c181a9185a
Add a few lines to the bottom of the manpage.
2012-12-20 12:25:50 +00:00
Stephen Dolan
6a597b41a6
Update download page and build system to handle more platforms.
2012-12-20 12:17:56 +00:00
Stephen Dolan
c85d8d8b4e
Don't enable coloured output by default on Windows.
2012-12-20 12:16:22 +00:00
Stephen Dolan
dcdb996085
Merge pull request #50 from stesh/master
...
Add information about installing dev environment on OS X
2012-12-20 03:41:19 -08:00
Stephen Dolan
5968f54f55
Fix a bug in stack reallocation during deep recursion.
2012-12-18 17:36:24 +00:00
Stephen Dolan
8dca3ef10d
Print an error message and abort in out-of-memory situations.
...
Closes #43 .
Tested with:
ulimit -v 5000
./jq -n -c 'def f(x): x,f([x,x]); f(0)'
2012-12-18 17:01:23 +00:00
Stephen Dolan
04daafbde3
Add wrappers for malloc/realloc/free. See #43 .
2012-12-18 16:53:51 +00:00
Stephen Dolan
75421cbfe3
Add the ability to specify input files on the commandline.
...
See #21 .
2012-12-16 19:46:41 +00:00
Stephen Dolan
b0aa62f2b7
Improve manpage introduction, add examples to manpage.
...
Closes #19
2012-12-16 17:11:40 +00:00
Stephen Dolan
3ae8fb7371
Fix a bug uncovered by tests extracted from manual.
...
`null | length` should give 0, and now does.
2012-12-16 13:10:48 +00:00
Stephen Dolan
73c657cdc4
Lots of build system and docs improvements, including a manpage.
...
- Build binaries for multiple platforms
- Make a manpage out of the manual (see #19 )
- Extract more tests from the documentation
- Fix a few documentation bugs uncovered by above.
2012-12-16 13:06:03 +00:00
Stephen Dolan
2b48ee4a8f
Add a Gemfile to make building the documentation easier.
...
Use "bundle install" in the docs folder to install ruby dependencies.
2012-12-12 23:18:43 +00:00
Stephen Dolan
8ba2cef913
Delete autogenerated source from the repository.
...
This was a horrible hack to fix build issues on OS X some time
ago. There are better ways to fix build issues on OS X :)
See #49 .
2012-12-10 22:36:01 +00:00
Stephen Dolan
dcc93042d3
some words explaining struct inst a little
2012-12-10 22:35:33 +00:00
Stephen Dolan
34ff993059
error() function
2012-12-10 22:30:09 +00:00
Stephen Dolan
b660bd2be6
Fix Rack setup so that viewing documentation locally is less painful.
2012-12-10 22:25:11 +00:00
Stephen Shaw
1db51e66bc
Remove old OS X 'instructions'
2012-12-07 14:40:29 +00:00
Stephen Shaw
c15e51ffb1
Add information about installing dev environment on OS X
2012-12-07 14:31:59 +00:00
Stephen Dolan
84026f0513
Change order of evaluation for certain indexing operations.
...
'.foo[.bar]' used to parse like '.foo | .bar as $b | .[$b]',
now it parses like '.bar as $b | .foo | .[$b]'.
2012-12-07 00:28:11 +00:00
Lee Thompson
a156fb19de
get testing working in autoconf
2012-12-04 19:50:10 -06:00
Lee Thompson
ca862a594c
kill prereq on RPM spec file
2012-12-04 19:00:59 -06:00
Lee Thompson
dfa9e61aeb
fixes jq_test core dump
2012-12-04 18:12:53 -06:00
Lee Thompson
99353d8c84
remove obsolete line
2012-12-04 16:50:11 -06:00
Stephen Dolan
c0a2f1ab47
Add min, max, min_by, max_by functions.
2012-12-04 22:45:03 +00:00
Lee Thompson
76c8706145
fix rpm mv command when rpm stashes the package in a subdirectory
2012-12-04 16:29:01 -06:00
Lee Thompson
277249ffe6
change rpmbuild target to rpm
2012-12-04 14:49:39 -06:00
Stephen Dolan
616e8f9924
Refactor function argument passing into what it always should have been.
...
Most visible change is that error messages when a function is called
with the wrong number of arguments are much better.
2012-12-04 00:39:21 +00:00
Lee Thompson
00e4feba81
get rpm building from tarball with autoconf
2012-12-03 17:27:40 -06:00
Lee Thompson
26bbed29f7
start work on getting RPM to work with tarball
2012-12-03 16:19:45 -06:00
Stephen Dolan
a88d53d2fd
Extend {foo} syntax to allow {"foo"} as well.
...
Useful when "foo" contains unusual characters. Should help with
the issues #7 , #38 , #40 , #42 .
2012-12-03 20:31:40 +00:00
Stephen Dolan
5f6a95c7b5
General cleanup - rename a few things, delete dead code.
2012-12-03 20:02:02 +00:00
Stephen Dolan
fadeb66365
Add a unique function.
2012-12-03 02:02:12 +00:00
Stephen Dolan
c8bbfed041
See, I told you colour was a bad idea! #11
...
Last commit broke the build, minor fix needed to testsuite.
2012-12-03 02:00:29 +00:00
Stephen Dolan
e9c7548b82
Oh alright then, if you insist.
...
Colo(u)red output for jq. Enabled by default if isatty(stdout).
Closes #11 .
2012-12-03 01:21:07 +00:00
Stephen Dolan
67f8ad9435
Ignore a UTF-8 BOM if one appears at the start of a JSON document.
...
Closes #45 .
2012-12-02 23:53:55 +00:00
Stephen Dolan
5b45184a1a
Make the -c output more compact. Closes #44 .
2012-12-02 23:24:07 +00:00
Stephen Dolan
11965aaa2e
sort_by and group_by functions, tests and docs.
2012-12-02 23:22:15 +00:00
Stephen Dolan
ed7f95a492
Demote "contains" to a built-in function rather than an operator.
2012-12-02 22:52:38 +00:00
Stephen Dolan
63d10433c9
Fix a horrible scoping/associativity bug.
...
`1 as $x | . | $x` didn't compile, as it was parsed as
(1 as $x | .) | $x
where `$x` is undefined, rather than as
1 as $x | (. | $x)
2012-12-02 22:22:08 +00:00
Stephen Dolan
ea9db414ed
Clean up implementation of builtin functions.
2012-12-02 22:12:08 +00:00
Stephen Dolan
b6f2fbbe62
Move all the includes one place to the left
2012-12-02 21:25:54 +00:00
Stephen Dolan
125e278502
Clean up calls to C functions, unify opcodes
2012-12-02 20:45:55 +00:00
Stephen Dolan
251f221b85
Refactor of function call codegen. Separate codegen for C and jq calls.
2012-12-02 20:45:06 +00:00
Stephen Dolan
9e743d517a
Sort function and more general comparison operators.
2012-11-30 20:27:16 +00:00
Lee Thompson
ddeec45b2e
revert back to make invoking flex, fix a few bugs
2012-11-28 01:08:23 -06:00
Lee Thompson
006357f954
initial attempt at autoconf implementation, removed all generated code from git
2012-11-27 16:02:59 -06:00
Stephen Dolan
2dad2bdd97
Merge remote-tracking branch 'origin/master'
2012-11-26 22:24:04 +00:00
Stephen Dolan
d56370f734
Move some higher-level JSON manipulation functions into jv_aux.{c,h}
2012-11-26 22:22:45 +00:00
Stephen Dolan
334a79b704
Define bytecoded builtins more concisely.
2012-11-26 18:53:47 +00:00
Stephen Dolan
4c65847568
Raise a proper error from the lexer on unmatched },),]
2012-11-26 01:40:35 +00:00
Stephen Dolan
4747f8681b
Transparent handling for CBV arguments to C functions.
...
C function arguments closures are inlined before the call.
2012-11-26 01:36:55 +00:00
Stephen Dolan
3e3fe51959
Clean up function creation API and epilogue generation.
2012-11-26 00:39:01 +00:00
Stephen Dolan
924aeda504
Add some preprocessor junk to make codegen cleaner.
2012-11-25 23:49:57 +00:00
Stephen Dolan
f19ba32fdd
Minor refactor of function call setup to allow for multiple arguments.
2012-11-25 23:07:43 +00:00
Anthony Shortland
a33c6f3df9
Fixed to work under CentOS 5.4
2012-10-30 14:30:36 -07:00
Anthony Shortland
04640aeaeb
Added initial support for packaging jq as an RPM
2012-10-30 10:26:08 -07:00
Stephen Dolan
0923c79fee
Merge pull request #36 from stroan/contains-operator
...
Implemented contains operator
2012-10-25 11:51:55 -07:00
Stephen Roantree
50bcbc2271
Merge branch 'master' of https://github.com/stedolan/jq into contains-operator
...
Conflicts:
lexer.gen.c
parser.gen.c
parser.gen.h
parser.gen.info
parser.y
2012-10-25 10:02:02 -07:00
Stephen Roantree
1b556315af
Remove redundant code from jv_object_contains
2012-10-25 06:29:23 -07:00
Stephen Roantree
ecc8998d38
Restructure contains methods to use public jv methods
2012-10-24 18:29:33 -07:00
Stephen Dolan
72691b4909
Fix a bug in string parsing. Closes #35
2012-10-25 00:13:39 +01:00
Stephen Roantree
5e25c2a259
Implemented contains operator
2012-10-24 13:50:26 -07:00
Stephen Dolan
033d9b2fd5
Merge pull request #34 from dgryski/master
...
Add != (not equal) to list of supported binops
2012-10-24 02:43:54 -07:00
Damian Gryski
0adf4638d1
Update generated lexer.gen.* and parser.gen.* files
2012-10-24 09:31:21 +02:00
Damian Gryski
e40778727b
Replace yyscan_t with another pointer type that we control.
...
This prevents the circuluar dependency between parser.gen.h and
lexer.gen.h. Newer versions of bison add a prototype for yyparse() to
parser.gen.h that include the as-yet-undeclared yyscan_t type.
2012-10-24 09:28:27 +02:00
Stephen Dolan
5a64a29774
Remove .gitignore from tarballs.
2012-10-23 21:58:50 +01:00
Damian Gryski
45b6fc8148
Add some in/equality test cases
2012-10-23 21:12:47 +02:00
Stephen Dolan
8ad3b6f9b9
Merge pull request #22 from alexchamberlain/patch-1
...
Arch Packaging docs
2012-10-23 11:24:12 -07:00
Damian Gryski
409456f581
Regenerate lex/yacc files
2012-10-23 17:02:19 +02:00
Damian Gryski
553de39b2a
Implement 'not equal' (!=) as a binop
2012-10-23 17:01:39 +02:00
Damian Gryski
b193bca563
yyscan_t isn't exposed by some versions of flex.
2012-10-23 17:00:42 +02:00
Alex Chamberlain
56aa4cf1df
Add docs for installing on Arch Linux.
2012-10-23 14:46:44 +01:00
Stephen Dolan
2a610da2d1
Allow the 'keys' function to take arrays.
2012-10-22 23:31:07 +01:00
Stephen Dolan
93f80b2726
I should probably document select and empty :) ( #29 , #5 )
2012-10-22 23:14:34 +01:00
Stephen Dolan
794d29a430
Docs fixes.
...
- Mention homebrew on download page (#25 )
- Document 'keys' and string interpolation
2012-10-22 22:56:56 +01:00
Stephen Dolan
3c8f5ea251
Merge pull request #14 from merriam/patch-2
...
Update docs/content/1.tutorial/default.yml
2012-10-22 14:31:04 -07:00
Stephen Dolan
c0f1c7dc1a
Delete a badly-thought-out bit of a Makefile.
2012-10-22 19:23:57 +01:00
Stephen Dolan
a737a67eda
updated autogenerated files
2012-10-22 19:18:35 +01:00
Stephen Dolan
48fb7c61b3
Support a -f option to load from a file, and # comments
...
This means '#!/usr/local/bin/jq -f' is now a sensible way
to start a file.
Closes #13
2012-10-22 19:18:30 +01:00
Stephen Dolan
f2601ab4f0
Fix logic for "slurp" option. Fixes #18
2012-10-22 18:55:56 +01:00
Stephen Dolan
2620e21dcc
Make the gen_utf8_tables script Python3 compatible ( #20 )
2012-10-22 18:47:52 +01:00
Charles Merriam
ce3328f11e
Update docs/content/1.tutorial/default.yml
2012-10-22 02:43:53 -07:00
Stephen Dolan
c53e001973
Version number tracking.
2012-10-21 23:26:31 +01:00
Stephen Dolan
976e4ff711
Fix a mistake in the docs. Fixes #10
2012-10-21 22:16:23 +01:00
Stephen Dolan
6e64cdcbfc
Merge pull request #8 from maxme/master
...
add install and uninstall rules in Makefile
2012-10-21 12:23:22 -07:00
Stephen Dolan
73e479e171
Update website: binaries + version bump.
2012-10-21 20:16:26 +01:00
Maxime Biais
758da604cd
add install and uninstall rules in Makefile
2012-10-21 20:55:50 +02:00
Stephen Dolan
95a0074edf
Check in a bunch of autogenerated files.
...
These seem not to build with the version of bison, etc. on OS X.
This is a hack for now, I'll fix the OS X build when I get access
to a mac.
2012-10-21 19:52:16 +01:00
Stephen Dolan
32e1b114df
Add a 'keys' function. Fixes #4 .
2012-10-20 00:26:37 +01:00
Stephen Dolan
afec2544f1
A string interpolation syntax that I don't hate. Also tests.
...
You can interpolate values into strings using \(this syntax), e.g.
"best \("str" + "ing") ever"
2012-10-20 00:09:20 +01:00
Stephen Dolan
6828ec9852
Merge pull request #6 from stroan/numeric-comparison-binops
...
Add <,>,<=,>= binops
2012-10-11 07:47:42 -07:00
Stephen Roantree
b3557429eb
Make comp binops nonassoc
2012-10-10 23:00:24 +01:00
Stephen Roantree
0618e61e0b
Add <,>,<=,>= binops
2012-10-07 22:34:12 +01:00
Stephen Dolan
a2643cc0d5
Allow underscores in IDENT tokens. Fixes #3 .
...
IDENT syntax now includes ASCII letters and underscores, so
'.foo_bar' now works. Non-ASCII letters won't work in IDENT
tokens (it's impossible to tell which non-ascii characters are
"letters" without full unicode tables), so '.données' is still
a syntax error (the workaround is '.["données"]', since you can
put anything you like in a string).
2012-09-22 14:03:46 +01:00
Stephen Dolan
359d5f33bd
Add a bunch of commandline options for controlling I/O format.
...
Also docs for the above. Closes #1 .
2012-09-20 19:31:14 +01:00
Stephen Dolan
fcd7cf4ddd
More broken links :(
2012-09-19 10:54:58 +01:00
Stephen Dolan
1f4a5d8d9f
Make URLs relative to not break on github-pages
2012-09-19 10:48:23 +01:00
Stephen Dolan
92ab193369
Make the <title>s of the doc pages less messy.
2012-09-19 01:15:49 +01:00
Stephen Dolan
fc57cf702c
No HTTPS for me, sadly.
2012-09-19 01:12:33 +01:00
Stephen Dolan
f51eca20f5
Fix some issues with relative URLs on Github Pages.
2012-09-19 01:10:47 +01:00
Stephen Dolan
9887cb57b2
Add a rake task to compile docs into static html.
2012-09-19 01:03:05 +01:00
Stephen Dolan
040604b7db
Use a theme from Bootswatch for docs.
2012-09-19 01:00:25 +01:00
Stephen Dolan
26c7132237
Ensure 'make tarball' creates the required directories.
2012-09-19 00:36:37 +01:00
Stephen Dolan
483f6f2134
Add some release stuff to Makefile.
2012-09-19 00:34:49 +01:00
Stephen Dolan
c463877e17
Add binaries and update download docs.
2012-09-19 00:08:02 +01:00
Stephen Dolan
71ab537ee9
Initialise some variables to keep gcc happy.
2012-09-18 23:46:23 +01:00
Stephen Dolan
134b062be7
Fix a parsing bug for \uXXXX escapes (some invalid escapes were accepted).
...
Found by gcc -O -Wall identifying a use of uninitialised variables.
2012-09-18 23:45:30 +01:00
Stephen Dolan
3898f744dc
Add a README
2012-09-18 23:40:19 +01:00
Stephen Dolan
305059ff9f
Usage messages if jq is run with no arguments.
...
Beats segfaulting.
2012-09-18 23:37:46 +01:00
Stephen Dolan
5863160112
Implement the 'add' builtin promised by the docs' examples.
2012-09-18 23:32:24 +01:00
Stephen Dolan
fbf7bc835b
More docs + docs cleanup
2012-09-18 23:17:27 +01:00
Stephen Dolan
04e85e11de
Print Unicode characters unescaped by default.
2012-09-18 22:47:19 +01:00
Stephen Dolan
20e45f363c
Separate the tests and the main program.
2012-09-18 22:17:13 +01:00
Stephen Dolan
46af5238ce
Add a COPYING file with too many words in it.
2012-09-18 17:59:09 +01:00
Stephen Dolan
cf134909fd
Documentation. Copious.
2012-09-18 17:51:53 +01:00
Stephen Dolan
a4eea165bb
Move everything around - delete old Haskell code, clean up build.
2012-09-18 17:44:43 +01:00
Stephen Dolan
25cbab056b
Slightly better string interpolation.
2012-09-18 13:22:22 +01:00
Stephen Dolan
8041ce3119
Add the builtin 'select' function.
2012-09-18 12:58:39 +01:00
Stephen Dolan
8f0c91c032
Add a missing file from prev commit
2012-09-18 12:58:29 +01:00
Stephen Dolan
940f8c4270
Builtin functions defined in jq.
2012-09-18 10:17:38 +01:00
Stephen Dolan
5b9bb64a88
-Werror was a little overzealous.
...
Older versions of gcc warn about random things. -Werror makes the
built fail on such compilers.
2012-09-18 09:43:44 +01:00
Stephen Dolan
7d8d97933f
Builtin function 'type'.
2012-09-17 23:06:48 +01:00
Stephen Dolan
f13865d7a1
Fix a precedence bug.
...
a == b or c == d should obviously parse as (a==b) or (c==d).
2012-09-17 22:37:51 +01:00
Stephen Dolan
49cf2e67fe
Recursive functions + bugfix for stack reallocation.
2012-09-17 22:32:06 +01:00
Stephen Dolan
cbdeddbab8
Make the code compile with warnings-as-errors.
...
-Wextra found a bona-fide bug: signed/unsigned comparison in a
stack overflow check.
2012-09-17 22:04:58 +01:00
Stephen Dolan
eab9c4e587
Fix debugging code in execute.c so that debug jq compiles again.
2012-09-17 21:43:10 +01:00
Stephen Dolan
830610cef8
Make "not" a builtin function rather than syntax.
...
Fixes a really awkward grammar issue.
2012-09-17 21:08:43 +01:00
Stephen Dolan
297a0679d1
Redefine true and false. Define empty, distict from null.
...
This might be the most philosophical commit. I shall ponder it.
true, false, null, empty now defined as bytecoded builtins rather
than calls out to C functions.
2012-09-17 20:59:34 +01:00
Stephen Dolan
fe33150b7f
Merge branch 'master' of github:stedolan/jq
...
Conflicts:
c/builtin.c
2012-09-17 20:49:41 +01:00
Stephen Dolan
3db27b01a1
First pass at string interpolation.
...
Requires a lexer hack, but a surprisingly un-hideous one. The lexer
maintains a stack of bracket characters so that it can match
parens/brackets/braces to tell where a subexp nested in a string
actually ends.
2012-09-17 20:41:57 +01:00
Stephen Dolan
326771f4b4
Add a "tostring" function.
2012-09-17 20:14:07 +01:00
Stephen Dolan
9c15ad2021
Support rendering a JSON value to a string buffer.
2012-09-17 20:11:12 +01:00
Stephen Dolan
84ea129f26
Better support for appending strings in JV.
2012-09-17 19:41:41 +01:00
Stephen Dolan
50ebb036c4
Bind builtin functions in a slightly less ugly way.
2012-09-16 17:08:56 +01:00
Stephen Dolan
539156430a
Builtin function 'length', for arrays/objects/strings.
2012-09-16 11:08:42 +01:00
Stephen Dolan
cc2fb20ca0
Hrm. Update operators (//=, +=, etc.) aren't very well thought out.
...
In complex cases, their behaviour is kinda weird. Here's a failing
test for what I think they should do.
2012-09-16 11:07:36 +01:00
Stephen Dolan
df195b3187
Add update operators (+=, -=, *=, /= and //=)
2012-09-11 23:55:59 +01:00
Stephen Dolan
f6c6ba95ad
Make .[] capable of iteration over objects as well as arrays.
...
Also change an assert to a proper error message if it's given
something silly like a number.
2012-09-11 16:10:55 +01:00
Stephen Dolan
d9d6f43407
Pretty-printing of JSON values.
2012-09-11 15:53:37 +01:00
Stephen Dolan
51a44edc63
JSON stream parser.
...
Allow multiple values on input as concatenated JSON objects,
possibly separated by whitespace.
2012-09-11 14:52:10 +01:00
Stephen Dolan
062a6aa6d7
More error handling - locations of refs to undefined symbols.
2012-09-11 12:24:54 +01:00
Stephen Dolan
4c7bede5a4
Better error handling and messages for invalid index/assign operations.
2012-09-11 10:37:44 +01:00
Stephen Dolan
0ce437ea97
More error handling in the parser.
...
Add a special case in the lexer to detect unterminated strings.
Add some error recovery in the parser for more copious error spam.
2012-09-11 10:18:18 +01:00
Stephen Dolan
ac3f8bcc52
Proper error messages from lexer errors (e.g. bad characters).
2012-09-11 09:13:20 +01:00
Stephen Dolan
95dd64b0f0
Much, much better error reporting from the parser.
...
Getting proper locations through flex/bison was more effort than
was advertised.
2012-09-11 00:04:47 +01:00
Stephen Dolan
4d47f8f1e1
'==' operator, tests for equality and operator precedence.
2012-09-10 18:08:00 +01:00
Stephen Dolan
3895bbf856
String -> number conversions with "tonumber".
2012-09-10 17:08:13 +01:00
Stephen Dolan
aa3ebdfe9b
Multiplication and division operators.
...
It is an error to use these on anything but numbers. Maybe later
implementing python/ruby-style ("a" * 100) might be handy.
2012-09-10 16:57:17 +01:00
Stephen Dolan
6f3abbac62
Subtraction - as expected for numbers, ruby-style set diff for arrays.
2012-09-10 16:49:25 +01:00
Stephen Dolan
65ce73deb4
String concatenation.
2012-09-10 16:16:39 +01:00
Stephen Dolan
e718bd50b6
Sensible error messages when a silly addition is performed.
...
Fix a test to no longer perform an invalid addition.
2012-09-10 16:15:05 +01:00
Stephen Dolan
a3e509034b
jv_string_fmt (create printf-formatted JSON strings)
2012-09-10 16:01:56 +01:00
Stephen Dolan
0159c0ecc5
Plug a memory leak in jv_object_merge
2012-09-10 15:08:58 +01:00
Stephen Dolan
649cac791a
Make jv_invalid() first-class values capable of holding an error.
2012-09-10 15:04:19 +01:00
Stephen Dolan
5c25c90657
When comparing two objects for equality, we don't need to recurse
...
into e.g. array elements if the two objects are the same array.
2012-09-10 13:06:46 +01:00
Stephen Dolan
c2593dc417
Make a main program that doesn't spam debugging info.
2012-09-10 10:23:15 +01:00
Stephen Dolan
e258d20ba2
Make the '+' operator merge objects.
2012-09-09 19:17:07 +01:00
Stephen Dolan
a4ff3d4670
Bugfix for expanding objects.
2012-09-09 18:09:05 +01:00
Stephen Dolan
e6a85737da
Print bad number values (Inf,NaN) "correctly".
2012-09-09 15:35:34 +01:00
Stephen Dolan
0dfaebcdcb
null and string literals now exist, so add tests
2012-09-06 21:44:46 +01:00
Stephen Dolan
0fd7d4b30c
UTF8 coding utilities and unicode escaping in jv_dump()'d strings.
...
Beyond the Basic Multilingual Plane, dead Cthulhu waits dreaming.
2012-09-06 21:39:00 +01:00
Stephen Dolan
58a9b0cfe1
Make the test harness not segfault when a test fails (!)
2012-09-04 20:56:44 +01:00
Stephen Dolan
da5d653de8
Add a Boolean "not" operator.
...
Not wholly convinced this is a good idea, maybe "not" should be a
builtin function instead? 'not (.a == .b)' vs. '.a == .b | not'
2012-09-04 20:43:40 +01:00
Stephen Dolan
6e6ea50763
Short-circuiting Boolean "and" and "or" operators.
2012-09-04 20:38:59 +01:00
Stephen Dolan
c5ab3b2336
Move some unicode handling stuff to a separate file.
2012-09-04 20:38:47 +01:00
Stephen Dolan
328c4a13f1
Add "elif" to if-then-else constructs.
2012-09-04 16:05:24 +01:00
Stephen Dolan
5add2c2ceb
if-then-else and defined-or operators
2012-09-04 15:34:34 +01:00
Stephen Dolan
520c7bb15e
Fix some confusion between "null" and "invalid".
2012-09-03 17:26:52 +01:00
Stephen Dolan
32e324a283
Fix a memory leak in JV and add more tests
2012-09-03 17:18:10 +01:00
Stephen Dolan
eea05ff924
Perl-style autovivification.
...
.foo.bar = 1 will cause objects to be created if they don't exist.
2012-09-03 16:50:38 +01:00
Stephen Dolan
c9dbe1aff8
squash a debug printf
2012-09-03 16:42:58 +01:00
Stephen Dolan
a8c3648ca5
JV_KIND_INVALID values to represent failed lookups, etc + various tests.
2012-09-03 16:16:14 +01:00
Stephen Dolan
d895d39ba9
Support "null" in JQ programs
2012-09-03 16:14:52 +01:00
Stephen Dolan
8fe9c8a22a
Make assignment work again: = and |= operators.
2012-09-03 15:33:59 +01:00
Stephen Dolan
d8fad1ed9b
Disallow a + before numbers (makes parsing easier, agrees with JSON)
2012-09-03 15:32:50 +01:00
Stephen Dolan
cf004c2b3a
Modify number formatting so that 1e-3 renders as 0.001, not .001
2012-09-03 13:57:53 +01:00
Stephen Dolan
6041fd7661
Literal strings and better literal numbers.
2012-09-03 13:57:47 +01:00
Stephen Dolan
52487ff812
Remove globals from parser, use explicit structure.
2012-09-03 01:12:42 +01:00
Stephen Dolan
22ffc0fdfc
Mark a constant array const in jvp_dtoa.c
2012-09-02 22:24:27 +01:00
Stephen Dolan
e3710c0d1f
Fix behaviour of stack at program termination.
2012-09-02 22:11:06 +01:00
Stephen Dolan
4f747e6fff
Move from Jansson to JV - proper freeing of memory
...
A few more tests, now passes valgrind.
2012-09-02 21:45:52 +01:00
Stephen Dolan
9da3e0d373
Clean up build a little and add .gitignore.
2012-09-02 17:24:17 +01:00
Stephen Dolan
f72c5ffac0
Move from Jansson to JV - interpreter loop
...
Passes tests, but leaks some memory.
2012-09-02 17:20:13 +01:00
Stephen Dolan
2cb9a6e61d
Move from Jansson to JV - everything but the interpreter loop
...
Passes valgrind --leak-check=full.
2012-09-02 16:31:59 +01:00
Stephen Dolan
22f8aed31e
Validation for empty objects
...
Now (correctly) fails to parse {,}
2012-09-02 00:24:23 +01:00
Stephen Dolan
e98624e5a9
First pass at a JSON parser
2012-09-01 19:16:43 +01:00
Stephen Dolan
92654f8204
Fix a memory leak when inserting into an object with an already-present key
2012-09-01 18:24:17 +01:00
Stephen Dolan
66fd702363
Minor changes to dtoa.c to make it easier to work with.
...
- Change memory allocation to thread a context structure through
the code rather than using globals (which would require a
-lpthread and some locking to become threadsafe).
- Remove a few configuration options (the "private memory" space,
and K&R style headers).
- Prefix exported symbols with jvp_ to prevent libc conflicts.
- Add jvp_dtoa.h
- Include netlib's g_fmt.c into dtoa.c
- Add a few not-strictly-necessary initialisations in order to
compile cleanly with gcc -Wall
2012-09-01 18:01:35 +01:00
Stephen Dolan
9e544c55dc
Import a copy of David Gay's dtoa.c
2012-09-01 16:50:25 +01:00
Stephen Dolan
f25cb16e6b
Fix a bug in lexical scoping, add tests
2012-08-28 18:38:30 +01:00
Stephen Dolan
463b175cdb
Reference-counted copy-on-write JSON library.
...
Comes with tests and, presumably, bugs.
2012-08-28 18:09:43 +01:00
Stephen Dolan
dc6cf2fb58
Remove syntax distinction between builtin and user calls
2012-08-27 11:19:42 +01:00
Stephen Dolan
6c8b55793a
first pass at assignment
2012-08-27 10:12:02 +01:00
Stephen Dolan
a847d2250f
2nd order functions
2012-08-26 14:25:56 +01:00
Stephen Dolan
befb103a12
Fix a revolting hack
2012-08-22 19:21:35 +01:00
Stephen Dolan
2086e59ab1
bugfix for backtracking over RET insns, and a truly evil testcase
2012-08-22 19:05:53 +01:00
Stephen Dolan
79d81f4bee
Closures over variables
2012-08-21 18:24:38 +01:00
Stephen Dolan
c128c2029e
First pass at functions + tests
2012-08-21 18:14:13 +01:00
Stephen Dolan
dd0d340eba
frame layout refactor
2012-08-21 12:35:44 +01:00
Stephen
15ad640202
Stacks grow down now
2012-08-20 15:53:20 +01:00
Stephen
fd738bface
an addition operator, of sorts
2012-08-16 01:16:08 +01:00
Stephen
2002dc1a2f
Most of a C implementation of jq
2012-08-16 01:00:30 +01:00