diff options
author | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-12-07 00:26:00 +0000 |
---|---|---|
committer | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-12-07 00:28:11 +0000 |
commit | 84026f051347a6c6668e70d120905beee0192535 (patch) | |
tree | 8bef2c846265348dad9dd9771586b13aefdb485e | |
parent | c0a2f1ab470595d85fd20a643325a16737433a2a (diff) |
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]'.
-rw-r--r-- | parser.y | 2 | ||||
-rw-r--r-- | testdata | 4 |
2 files changed, 5 insertions, 1 deletions
@@ -133,7 +133,7 @@ static block gen_dictpair(block k, block v) { } static block gen_index(block obj, block key) { - return BLOCK(obj, gen_subexp(key), gen_op_simple(INDEX)); + return BLOCK(gen_subexp(key), obj, gen_op_simple(INDEX)); } static block gen_binop(block a, block b, int op) { @@ -464,3 +464,7 @@ unique [min,max,min_by(.),max_by(.)] [] [null,null,null,null] + +.foo[.baz] +{"foo":{"bar":4},"baz":"bar"} +4 |