summaryrefslogtreecommitdiffstats
path: root/src/parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.y')
-rw-r--r--src/parser.y26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/parser.y b/src/parser.y
index 62558502..2fdaed2f 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -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)) {