Stephen Dolan
49cf2e67fe
Recursive functions + bugfix for stack reallocation.
2012-09-17 22:32:06 +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
84ea129f26
Better support for appending strings in JV.
2012-09-17 19:41:41 +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
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
e258d20ba2
Make the '+' operator merge objects.
2012-09-09 19:17:07 +01:00
Stephen Dolan
0dfaebcdcb
null and string literals now exist, so add tests
2012-09-06 21:44:46 +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
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
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
a8c3648ca5
JV_KIND_INVALID values to represent failed lookups, etc + various tests.
2012-09-03 16:16:14 +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
f25cb16e6b
Fix a bug in lexical scoping, add tests
2012-08-28 18:38:30 +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
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