Allow keywords in more places (fix #1868)

This commit is contained in:
Nicolas Williams committed 2019-03-24 23:19:09 -05:00
1 parent 3ea0199e03
commit c72ed135e4
6 files changed
+2037 -1374

No files matched your search

+21 -5
View File
@@ -576,7 +576,10 @@ Param:
$$ = gen_param_regular(jv_string_value($2));
jv_free($2);
} |
'$' Keyword {
$$ = gen_param_regular(jv_string_value($2));
jv_free($2);
} |
IDENT {
$$ = gen_param(jv_string_value($1));
jv_free($1);
@@ -734,14 +737,19 @@ FORMAT {
else
$$ = BLOCK(gen_subexp(gen_const(jv_object())), $2, gen_op_simple(POP));
} |
'$' LOC {
$$ = gen_const(JV_OBJECT(jv_string("file"), jv_copy(locations->fname),
jv_string("line"), jv_number(locfile_get_line(locations, @$.start) + 1)));
} |
'$' IDENT {
$$ = gen_location(@$, locations, gen_op_unbound(LOADV, jv_string_value($2)));
jv_free($2);
} |
'$' Keyword {
if (strcmp(jv_string_value($2), "__loc__") == 0) {
$$ = gen_const(JV_OBJECT(jv_string("file"), jv_copy(locations->fname),
jv_string("line"), jv_number(locfile_get_line(locations, @$.start) + 1)));
} else {
$$ = gen_location(@$, locations, gen_op_unbound(LOADV, jv_string_value($2)));
}
jv_free($2);
} |
IDENT {
const char *s = jv_string_value($1);
if (strcmp(s, "false") == 0)
@@ -939,10 +947,18 @@ IDENT ':' ExpD {
$$ = gen_dictpair(gen_const($2),
gen_location(@$, locations, gen_op_unbound(LOADV, jv_string_value($2))));
}
| '$' Keyword {
$$ = 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)));
}
| Keyword {
$$ = gen_dictpair(gen_const(jv_copy($1)),
gen_index(gen_noop(), gen_const($1)));
}
| '(' Exp ')' ':' ExpD {
jv msg = check_object_key($2);
if (jv_is_valid(msg)) {