Improve invalid object key error message

This commit is contained in:
David Tolnay committed 2015-09-16 09:53:42 -07:00
1 parent 1758c1ba74
commit b52bebfbe8
2 files changed
+803 -796

No files matched your search

+795 -795
View File
File diff suppressed because it is too large. Load diff
+8 -1
View File
@@ -809,6 +809,10 @@ String ':' Pattern {
} | } |
'(' Exp ')' ':' Pattern { '(' Exp ')' ':' Pattern {
$$ = gen_object_matcher($2, $5); $$ = gen_object_matcher($2, $5);
} |
error ':' Pattern {
FAIL(@$, "May need parentheses around object key");
$$ = $3;
} }
Keyword: Keyword:
@@ -903,7 +907,10 @@ IDENT ':' ExpD {
| '(' Exp ')' ':' ExpD { | '(' Exp ')' ':' ExpD {
$$ = gen_dictpair($2, $5); $$ = gen_dictpair($2, $5);
} }
| '(' error ')' ':' ExpD { $$ = $5; } | error ':' ExpD {
FAIL(@$, "May need parentheses around object key");
$$ = $3;
}
%% %%
int jq_parse(struct locfile* locations, block* answer) { int jq_parse(struct locfile* locations, block* answer) {