Nicolas Williams
579518c78d
Use include for import into namespace
2015-07-10 10:19:33 -05:00
Nicolas Williams
aaf305868c
Restore import into caller's namespace
2015-06-26 23:40:37 -05:00
Nicolas Williams
e16bd17571
Add {$var} . as {$var} syntax ( fix #831 )
2015-06-26 20:45:14 -05:00
Nicolas Williams
b9c2a326ba
Fix #814 : raise on div-0, add inf isinf nan isnan
2015-06-17 19:58:55 -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
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
24005287f4
Add $__loc__ ( fix #740 )
2015-03-30 22:36:04 -05:00
Nicolas Williams
ffa2832e33
Drop name-less label/break for now
...
See #734 and #658 .
2015-03-24 01:21:17 -05: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
1ba8c2cfa6
Add module directive, modulemeta builtin
...
Fix #425 .
2014-08-14 03:26:26 -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
c321c3b86b
Constant fold objects
2014-08-09 20:47:03 -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
8cddb7c681
Allow any number of jq-coded function arguments
2014-08-09 12:42:39 -05:00
Nicolas Williams
32c08d48f3
Add def f($arg): syntax ( fix #524 )
2014-08-08 19:16:01 -05:00
Nicolas Williams
0d437e25de
Better error msg for bad shell quoting ( fix #538 )
2014-08-06 17:51:53 -05:00
William Langford
a25950a58c
Remove duplicate TOP insertions, drop unused defs.
2014-08-05 00:46:10 -04:00
Nicolas Williams
2e2538ccb8
Fold constants ( fix #504 )
2014-07-27 17:48:49 -05:00
Nicolas Williams
10f5a3448d
Do fix remaining bison warning ( fix #433 )
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
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
Nicolas Williams
c38e5b1b2c
Lib defs don't bind to each other; fix #479 again
2014-07-13 18:36:27 -05:00
Nicolas Williams
5be80b81eb
Add foreach EXP as $var (INIT; UPDATE) form
2014-07-09 00:43:06 -05:00
Nicolas Williams
8780bc0b8e
Better check for lib has only functions ( fix #138 )
2014-07-07 16:03:32 -05:00
Nicolas Williams
5a863bf010
Add foreach and limit
2014-07-06 19:40:05 -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
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
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
Stephen Dolan
18e828f17c
Allow negated object values without parens. Fixes #247
2013-12-17 22:28:31 +00:00
Nicolas Williams
474386a1d9
Complete more-arity feature not complete
...
And test
2013-12-11 14:14:26 -06:00
Nicolas Williams
1fc5656762
Support more arguments for defs
2013-12-04 18:21:38 -06:00
Juan Guerrero
9e53f36a74
Fix typo on error message
2013-10-06 17:52:04 +02:00
Stephen Dolan
dae2422fd1
Merge branch 'libjq'
...
Conflicts:
Makefile.am
configure.ac
2013-09-14 19:30:39 +01:00
Stephen Dolan
37cfc912c1
Remove #includes from jv.h
2013-06-23 14:23:07 +01:00
Nicolas Williams
3403d07912
Add mod (and setmod) operators
2013-06-21 15:27:34 -05:00
Stephen Dolan
824ce76cec
Simplify block functions for variables
2013-06-18 01:07:18 +01:00
Stephen Dolan
81e2336ace
Support ."foo" syntax for accessing fields. See #141 .
2013-06-11 22:26:39 +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
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
bc42812715
Remove the insane "fold" operation, replace with saner "reduce".
2013-05-16 15:07:53 +01:00
Stephen Dolan
33901b74b1
Array slicing. Closes #2 .
2013-05-13 20:16:19 +01:00
Stephen Dolan
d8706fd460
Fix the //= operator.
...
Closes #62 .
2013-05-13 16:04:30 +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
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
Lee Thompson
c7725a8d4d
merging upstream stedolan changes
2013-02-02 20:39:23 -06:00
Stephen Dolan
925ec3751f
Fix negative number syntax. Add a unary '-' operator.
...
Closes #63 .
2013-01-03 12:53:23 +00:00