Commit Graph
100 Commits
Author SHA1 Message Date
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 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
Stephen Dolan c0a2f1ab47 Add min, max, min_by, max_by functions. 2012-12-04 22:45:03 +00: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
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
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
Stephen Dolan 0923c79fee Merge pull request #36 from stroan/contains-operator
Implemented contains operator
2012-10-25 11:51:55 -07:00
Stephen Dolan 72691b4909 Fix a bug in string parsing. Closes #35 2012-10-25 00:13:39 +01: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
Stephen Dolan 5a64a29774 Remove .gitignore from tarballs. 2012-10-23 21:58:50 +01:00
Stephen Dolan 8ad3b6f9b9 Merge pull request #22 from alexchamberlain/patch-1
Arch Packaging docs
2012-10-23 11:24:12 -07: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
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
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 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 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