1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Add {$var} . as {$var} syntax (fix #831)

This commit is contained in:
Nicolas Williams
2015-06-26 20:29:04 -05:00
parent 25d47ca08e
commit e16bd17571
2 changed files with 680 additions and 655 deletions

1328
parser.c

File diff suppressed because it is too large Load Diff

View File

@@ -766,6 +766,9 @@ ObjPats ',' ObjPat {
}
ObjPat:
'$' IDENT {
$$ = gen_object_matcher(gen_const($2), gen_op_unbound(STOREV, jv_string_value($2)));
} |
IDENT ':' Pattern {
$$ = gen_object_matcher(gen_const($1), $3);
} |
@@ -857,6 +860,10 @@ IDENT ':' ExpD {
$$ = gen_dictpair($1, BLOCK(gen_op_simple(POP), gen_op_simple(DUP2),
gen_op_simple(DUP2), gen_op_simple(INDEX)));
}
| '$' IDENT {
$$ = gen_dictpair(gen_const($2),
gen_location(@$, locations, gen_op_unbound(LOADV, jv_string_value($2))));
}
| IDENT {
$$ = gen_dictpair(gen_const(jv_copy($1)),
gen_index(gen_noop(), gen_const($1)));