Commit Graph
25 Commits
Author SHA1 Message Date
Stephen Dolan d5fdf70434 Refactor assignment.
New version is much more elegant and probably slower. Uses
library functions implemented in jq rather than dedicated opcodes.
2012-12-29 16:43:36 +00:00
Stephen Dolan f1e23448e7 Support for two-argument functions.
Should probably support n args instead. This is a quick hack.
Also, ';' is a slightly ugly argument separator.
2012-12-28 15:07:27 +00:00
Stephen Dolan 417899f9a0 Fold operation (code/docs/test) 2012-12-28 15:05:34 +00:00
Stephen Dolan 89e26969ae @foo syntax for encoding of strings into various formats.
Fixes part of #47 and #48.
2012-12-28 01:23:09 +00:00
Stephen Dolan 04daafbde3 Add wrappers for malloc/realloc/free. See #43. 2012-12-18 16:53:51 +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 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 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 2dad2bdd97 Merge remote-tracking branch 'origin/master' 2012-11-26 22:24:04 +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 Roantree 50bcbc2271 Merge branch 'master' of https://github.com/stedolan/jq into contains-operator
Conflicts:
	lexer.gen.c
	parser.gen.c
	parser.gen.h
	parser.gen.info
	parser.y
2012-10-25 10:02:02 -07:00
Stephen Dolan 72691b4909 Fix a bug in string parsing. Closes #35 2012-10-25 00:13:39 +01:00
Stephen Roantree 5e25c2a259 Implemented contains operator 2012-10-24 13:50:26 -07:00
Damian Gryski e40778727b Replace yyscan_t with another pointer type that we control.
This prevents the circuluar dependency between parser.gen.h and
lexer.gen.h.  Newer versions of bison add a prototype for yyparse() to
parser.gen.h that include the as-yet-undeclared yyscan_t type.
2012-10-24 09:28:27 +02:00
Damian Gryski 553de39b2a Implement 'not equal' (!=) as a binop 2012-10-23 17:01:39 +02:00
Damian Gryski b193bca563 yyscan_t isn't exposed by some versions of flex. 2012-10-23 17:00:42 +02: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 Roantree b3557429eb Make comp binops nonassoc 2012-10-10 23:00:24 +01:00
Stephen Roantree 0618e61e0b Add <,>,<=,>= binops 2012-10-07 22:34:12 +01:00
Stephen Dolan a4eea165bb Move everything around - delete old Haskell code, clean up build. 2012-09-18 17:44:43 +01:00