Commit Graph
1849 Commits
Author SHA1 Message Date
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
Stephen Dolan eca89acee0 initial 2012-07-18 20:57:59 +01:00