1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00: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
2014-08-14 03:31:25 -05:00
2015-07-10 13:21:00 -07:00
2015-07-10 12:28:21 -05:00
2015-07-19 09:38:50 -07:00
2013-12-04 18:21:41 -06:00
2015-07-19 09:38:50 -07:00
2015-07-19 09:38:50 -07:00
2015-07-10 11:12:24 -05:00
2015-07-19 09:38:50 -07:00
2015-07-18 21:12:08 -05:00
2015-07-10 07:15:44 -07:00
2015-07-19 09:38:50 -07:00
2015-07-19 09:38:50 -07:00
2015-05-11 21:36:46 -05:00
2015-07-19 09:38:50 -07:00
2015-07-04 15:08:01 -07:00
2013-12-27 12:49:15 -06:00
2015-07-19 09:38:50 -07:00
2015-07-19 09:38:50 -07:00
2015-07-19 09:38:50 -07:00
2015-07-19 09:38:50 -07:00
2013-06-22 13:34:24 +01:00
2015-07-19 09:38:50 -07:00
2015-07-19 09:38:50 -07:00
2015-07-10 10:19:33 -05:00
2015-07-10 10:19:33 -05:00
2015-07-10 10:19:33 -05:00
2015-03-30 22:36:04 -05:00
2015-04-28 10:36:21 -05:00
2015-07-04 15:08:01 -07:00
2015-06-27 11:25:01 -07:00
2015-07-10 11:26:29 -05:00
2015-05-02 17:36:37 -05:00
2015-07-19 09:38:50 -07:00
2015-07-04 13:45:24 -05:00

jq

jq is a command-line JSON processor.

If you want to learn to use jq, read the documentation at http://stedolan.github.io/jq. This documentation is generated from the docs/ folder of this repository. You can also try it online at jqplay.org.

If you want to hack on jq, feel free, but be warned that its internals are not well-documented at the moment. Bring a hard hat and a shovel. Also, read the wiki: http://github.com/stedolan/jq/wiki

Source tarball and built executable releases can be found on the homepage and on the github release page, https://github.com/stedolan/jq/releases

If you're building directly from the latest git, you'll need flex, bison (3.0 or newer), libtool, make, and autoconf installed. To get regexp support you'll also need to install Oniguruma (note that jq's tests require regexp support to pass). To build, run:

autoreconf -i   # if building from git
./configure
make -j8
make check

To build without bison or flex, add --disable-maintainer-mode to the ./configure invocation:

./configure --disable-maintainer-mode

(Developers must not use --disable-maintainer-mode, not when making changes to the jq parser and/or lexer.)

To build a statically linked version of jq, run:

make LDFLAGS=-all-static

After make finishes, you'll be able to use ./jq. You can also install it using:

sudo make install

If you're not using the latest git version but instead building a released tarball (available on the website), then you won't need to run autoreconf (and shouldn't), and you won't need flex or bison.

To cross-compile for OS X and Windows, see docs/Rakefile's build task and scripts/crosscompile. You'll need a cross-compilation environment, such as Mingw for cross-compiling for Windows.

Cross-compilation requires a clean workspace, then:

# git clean ...
autoreconf -i
./configure
make distclean
scripts/crosscompile <name-of-build> <configure-options>

Use the --host= and --target= ./configure options to select a cross-compilation environment. See also the wiki.

Send questions to http://stackoverflow.com/questions/tagged/jq or to the #jq channel (http://irc.lc/freenode/%23jq/) on Freenode (https://webchat.freenode.net/).

Description
No description provided
Readme 47 MiB
Languages
C 78.5%
M4 6.8%
Shell 4.6%
Yacc 3.6%
jq 2.5%
Other 4%