py/compile: Provide terse error message for invalid dict/set literals.
diff --git a/py/compile.c b/py/compile.c
index 4fe5985..b2811e9 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -2433,13 +2433,21 @@
compile_node(comp, pn_i);
if (is_dict) {
if (!is_key_value) {
- compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting key:value for dictionary");
+ if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
+ compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax");
+ } else {
+ compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting key:value for dict");
+ }
return;
}
EMIT(store_map);
} else {
if (is_key_value) {
- compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting just a value for set");
+ if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
+ compile_syntax_error(comp, (mp_parse_node_t)pns, "invalid syntax");
+ } else {
+ compile_syntax_error(comp, (mp_parse_node_t)pns, "expecting just a value for set");
+ }
return;
}
}