diff options
author | Damien George <damien.p.george@gmail.com> | 2017-03-29 12:44:27 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-03-29 12:44:27 +1100 |
commit | f9b0e644e5e47cbdd15523d18328b07a5845d23f (patch) | |
tree | 848ef132ec366bc928a4bd3c5ced28ce26642d9d /py | |
parent | 18c059febfd713271155d25a3a28661e8911ef8d (diff) | |
download | micropython-f9b0e644e5e47cbdd15523d18328b07a5845d23f.tar.gz micropython-f9b0e644e5e47cbdd15523d18328b07a5845d23f.zip |
py/compile: Provide terse error message for invalid dict/set literals.
Diffstat (limited to 'py')
-rw-r--r-- | py/compile.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/py/compile.c b/py/compile.c index 4fe59853c2..b2811e9585 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2433,13 +2433,21 @@ STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) { 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; } } |